Exemplo n.º 1
0
    def test_digests_for_file_obj_are_sensible_to_secret_keys(self):
        file1 = StringIO('Some content')
        file2 = file1.getvalue()

        self.assertNotEqual(
            utils.make_digest(file1),
            utils.make_digest(file2, secret='bar')
        )
Exemplo n.º 2
0
    def test_digests_for_file_objects(self):
        file1 = StringIO('Some content')
        file2 = file1.getvalue()

        self.assertEqual(
            utils.make_digest(file1),
            utils.make_digest(file2)
        )
Exemplo n.º 3
0
 def test_invalid_messages_raise_TypeError(self):
     self.assertRaises(
         TypeError,
         lambda: utils.make_digest(object()))
Exemplo n.º 4
0
 def test_digests_have_no_newline_char(self):
     self.assertFalse('\n' in utils.make_digest('foo'))
Exemplo n.º 5
0
 def test_digests_are_sensible_to_secret_keys(self):
     self.assertNotEqual(
         utils.make_digest('foo'),
         utils.make_digest('foo', secret='bar')
     )
Exemplo n.º 6
0
 def test_digests_are_determinist(self):
     self.assertEqual(
         utils.make_digest('foo'),
         utils.make_digest('foo')
     )