def test_str_key(self): """ test key as string """ key = self.key func = config.transposition(key) self.assertEncryptedTransposition(func, self.secret)
def test_bytes_key(self): """ test key as bytes """ key = bytes(self.key, encoding='utf-8') func = config.transposition(key) self.assertEncryptedTransposition(func, self.secret)
def test_list_key(self): """ test key as list """ key = [ord(x) for x in self.key] func = config.transposition(key) self.assertEncryptedTransposition(func, self.secret)
def test_tuple_key(self): """ test key as tuple """ key = tuple([ord(x) for x in self.key]) func = config.transposition(key) self.assertEncryptedTransposition(func, self.secret)
def test_mixed_key_fails(self): """ test iterable of different types raises ValueError """ with self.assertRaises(ValueError): f = config.transposition((7, 't'))
def test_reverse_transposition(self): """ test reverse transposition """ transpose = config.transposition(b'test') self.assertEqual(transpose(b'\x00\x00\x00\x00'), b'test')
def setUp(self): self.key = 'secret' self.callback = config.transposition(self.key) self.credentials = config.Credentials({}, callback=self.callback)
def setUp(self): self.path = TMPDIR / 'jamf.config.secure.test.plist' self.config = config.SecureConfig(path=self.path) self.transpose = config.transposition(config.MAGIC)