Exemple #1
0
 def test_program_does_not_pad_complete_block(self):
     key = cli_util.create_key_file("0123456789abcdef")
     msg = "fedcba9876543210"
     status, block, err = cli_util.run_process(msg, 'c', key.name)
     self.assertEqual(block, msg)
Exemple #2
0
 def test_program_only_unpads_last_block(self):
     key = cli_util.create_key_file("0123456789abcdef")
     msg = "9876543210\x06\x06\x06\x06\x06\x06" * 2
     expected = msg[:-6]
     status, out, err = cli_util.run_process(msg, 'd', key.name)
     self.assertEqual(out, expected, err)
Exemple #3
0
 def test_program_fail_with_wrong_command(self):
     key = cli_util.create_key_file('0123456789abcdef')
     status, _, _ = cli_util.run_process('c', key.name)
     self.assertEqual(status, 1)
Exemple #4
0
 def test_program_pads_uncomplete_block(self):
     key = cli_util.create_key_file("0123456789abcdef")
     msg, expected = "9876543210", "9876543210\x06\x06\x06\x06\x06\x06"
     status, block, err = cli_util.run_process(msg, 'c', key.name)
     self.assertEqual(block, expected)
Exemple #5
0
 def test_program_fail_with_bad_key_size(self):
     key = cli_util.create_key_file('0123456789')
     status, _, _ = cli_util.run_process('c', key.name)
     self.assertEqual(status, 1)