@ -24,8 +24,8 @@ class TestRPCAuth(unittest.TestCase):
self . rpcauth = importlib . import_module ( ' rpcauth ' )
self . rpcauth = importlib . import_module ( ' rpcauth ' )
def test_generate_salt ( self ) :
def test_generate_salt ( self ) :
self . assertLessEqual ( len ( self . rpcauth . generate_salt ( ) ) , 32 )
for i in range ( 16 , 32 + 1 ) :
self . assert Greater Equal( len ( self . rpcauth . generate_salt ( ) ) , 16 )
self . assert Equal( len ( self . rpcauth . generate_salt ( i ) ) , i * 2 )
def test_generate_password ( self ) :
def test_generate_password ( self ) :
password = self . rpcauth . generate_password ( )
password = self . rpcauth . generate_password ( )
@ -34,7 +34,7 @@ class TestRPCAuth(unittest.TestCase):
self . assertEqual ( expected_password , password )
self . assertEqual ( expected_password , password )
def test_check_password_hmac ( self ) :
def test_check_password_hmac ( self ) :
salt = self . rpcauth . generate_salt ( )
salt = self . rpcauth . generate_salt ( 16 )
password = self . rpcauth . generate_password ( )
password = self . rpcauth . generate_password ( )
password_hmac = self . rpcauth . password_to_hmac ( salt , password )
password_hmac = self . rpcauth . password_to_hmac ( salt , password )