예제 #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')
        )
예제 #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)
        )
예제 #3
0
 def test_invalid_messages_raise_TypeError(self):
     self.assertRaises(
         TypeError,
         lambda: utils.make_digest(object()))
예제 #4
0
 def test_digests_have_no_newline_char(self):
     self.assertFalse('\n' in utils.make_digest('foo'))
예제 #5
0
 def test_digests_are_sensible_to_secret_keys(self):
     self.assertNotEqual(
         utils.make_digest('foo'),
         utils.make_digest('foo', secret='bar')
     )
예제 #6
0
 def test_digests_are_determinist(self):
     self.assertEqual(
         utils.make_digest('foo'),
         utils.make_digest('foo')
     )