Changeset View
Changeset View
Standalone View
Standalone View
test/util/rpcauth-test.py
Show All 13 Lines | |||||
class TestRPCAuth(unittest.TestCase): | class TestRPCAuth(unittest.TestCase): | ||||
def setUp(self): | def setUp(self): | ||||
config = configparser.ConfigParser() | config = configparser.ConfigParser() | ||||
config_path = os.path.abspath( | config_path = os.path.abspath( | ||||
os.path.join(os.sep, os.path.abspath(os.path.dirname(__file__)), | os.path.join(os.sep, os.path.abspath(os.path.dirname(__file__)), | ||||
"../config.ini")) | "../config.ini")) | ||||
with open(config_path) as config_file: | with open(config_path, encoding="utf8") as config_file: | ||||
config.read_file(config_file) | config.read_file(config_file) | ||||
sys.path.insert(0, os.path.dirname(config['environment']['RPCAUTH'])) | sys.path.insert(0, os.path.dirname(config['environment']['RPCAUTH'])) | ||||
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) | self.assertLessEqual(len(self.rpcauth.generate_salt()), 32) | ||||
self.assertGreaterEqual(len(self.rpcauth.generate_salt()), 16) | self.assertGreaterEqual(len(self.rpcauth.generate_salt()), 16) | ||||
Show All 21 Lines |