From 2e080055ea09c3b32731e738e792065a5c59cf87 Mon Sep 17 00:00:00 2001 From: Adam Kelly Date: Wed, 19 Aug 2020 14:26:55 +0100 Subject: [PATCH] Fix invalid digest test. --- fedireads/tests/test_signing.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fedireads/tests/test_signing.py b/fedireads/tests/test_signing.py index 0293a2d3c..fd169a696 100644 --- a/fedireads/tests/test_signing.py +++ b/fedireads/tests/test_signing.py @@ -33,7 +33,7 @@ class Signature(TestCase): public_key, ) - def send(self, signature, now, data): + def send(self, signature, now, data, digest): c = Client() return c.post( urlsplit(self.rat.inbox).path, @@ -42,7 +42,7 @@ class Signature(TestCase): **{ 'HTTP_DATE': now, 'HTTP_SIGNATURE': signature, - 'HTTP_DIGEST': make_digest(data), + 'HTTP_DIGEST': digest, 'HTTP_CONTENT_TYPE': 'application/activity+json; charset=utf-8', 'HTTP_HOST': DOMAIN, } @@ -57,9 +57,10 @@ class Signature(TestCase): date=None): now = date or http_date() data = get_follow_data(sender, self.rat) + digest = digest or make_digest(data) signature = make_signature( - signer or sender, self.rat.inbox, now, digest or make_digest(data)) - return self.send(signature, now, send_data or data) + signer or sender, self.rat.inbox, now, digest) + return self.send(signature, now, send_data or data, digest) def test_correct_signature(self): response = self.send_test_request(sender=self.mouse)