def test_signature_check(self): """Test the signature check function for WebHooks.""" payload = 'A body' key = 'SECRET' post_signature = 'sha1=abacb5cff87d9e0122683d0d1d18a150809ac700' self.assertTrue(helpers.signature_check(key, post_signature, payload)) post_signature = 'abacb5cff87d9e0122683d0d1d18a150809ac700' self.assertFalse(helpers.signature_check(key, post_signature, payload)) post_signature = 'sha1=' self.assertFalse(helpers.signature_check(key, post_signature, payload)) post_signature = 'sha1=wrong' self.assertFalse(helpers.signature_check(key, post_signature, payload))