def _load_encryption_keys(self): path = os.path.join(self._path, "data", "default", "encryptionKeys.js") with open(path, "r") as f: key_data = json.load(f) self._encryption_keys = {} for key_definition in key_data["list"]: key = EncryptionKey(**key_definition) self._encryption_keys[key.identifier] = key
def test_unlocking_with_incorrect_password(self): key = EncryptionKey(**self.example_data) unlock_result = key.unlock(password="******") self.assertFalse(unlock_result)
def test_unlocking_with_correct_password(self): key = EncryptionKey(**self.example_data) unlock_result = key.unlock(password="******") self.assertTrue(unlock_result)
def test_iterations_minimum(self): key = EncryptionKey(data="", iterations=500) self.assertEqual(1000, key.iterations)
def test_iterations_default(self): key = EncryptionKey(data="") self.assertEqual(1000, key.iterations)
def test_iterations_with_number(self): key = EncryptionKey(data="", iterations=5000) self.assertEqual(5000, key.iterations)
def test_iterations_with_string(self): key = EncryptionKey(data="", iterations="40000") self.assertEqual(40000, key.iterations)
def test_level(self): key = EncryptionKey(data="", level="SL3") self.assertEqual("SL3", key.level)
def test_identifier(self): key = EncryptionKey(data="", identifier="ABC123") self.assertEqual("ABC123", key.identifier)