def test_digests_are_sensible_to_secret_keys(self): self.assertNotEqual(utils.make_digest("foo"), utils.make_digest("foo", secret="bar"))
def test_digests_are_determinist(self): self.assertEqual(utils.make_digest("foo"), utils.make_digest("foo"))
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"))
def test_digests_for_file_objects(self): file1 = StringIO("Some content") file2 = file1.getvalue() self.assertEqual(utils.make_digest(file1), utils.make_digest(file2))
def test_invalid_messages_raise_TypeError(self): self.assertRaises(TypeError, lambda: utils.make_digest(object()))
def test_digests_have_no_newline_char(self): self.assertFalse("\n" in utils.make_digest("foo"))