Beispiel #1
0
 def test_str_key(self):
     """
     test key as string
     """
     key = self.key
     func = config.transposition(key)
     self.assertEncryptedTransposition(func, self.secret)
Beispiel #2
0
 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)
Beispiel #3
0
 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)
Beispiel #4
0
 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)
Beispiel #5
0
 def test_mixed_key_fails(self):
     """
     test iterable of different types raises ValueError
     """
     with self.assertRaises(ValueError):
         f = config.transposition((7, 't'))
Beispiel #6
0
 def test_reverse_transposition(self):
     """
     test reverse transposition
     """
     transpose = config.transposition(b'test')
     self.assertEqual(transpose(b'\x00\x00\x00\x00'), b'test')
Beispiel #7
0
 def setUp(self):
     self.key = 'secret'
     self.callback = config.transposition(self.key)
     self.credentials = config.Credentials({}, callback=self.callback)
Beispiel #8
0
 def setUp(self):
     self.path = TMPDIR / 'jamf.config.secure.test.plist'
     self.config = config.SecureConfig(path=self.path)
     self.transpose = config.transposition(config.MAGIC)