mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-27 10:30:32 +00:00
Fix invalid digest test.
This commit is contained in:
parent
8fc67d7b3c
commit
2e080055ea
1 changed files with 5 additions and 4 deletions
|
@ -33,7 +33,7 @@ class Signature(TestCase):
|
||||||
public_key,
|
public_key,
|
||||||
)
|
)
|
||||||
|
|
||||||
def send(self, signature, now, data):
|
def send(self, signature, now, data, digest):
|
||||||
c = Client()
|
c = Client()
|
||||||
return c.post(
|
return c.post(
|
||||||
urlsplit(self.rat.inbox).path,
|
urlsplit(self.rat.inbox).path,
|
||||||
|
@ -42,7 +42,7 @@ class Signature(TestCase):
|
||||||
**{
|
**{
|
||||||
'HTTP_DATE': now,
|
'HTTP_DATE': now,
|
||||||
'HTTP_SIGNATURE': signature,
|
'HTTP_SIGNATURE': signature,
|
||||||
'HTTP_DIGEST': make_digest(data),
|
'HTTP_DIGEST': digest,
|
||||||
'HTTP_CONTENT_TYPE': 'application/activity+json; charset=utf-8',
|
'HTTP_CONTENT_TYPE': 'application/activity+json; charset=utf-8',
|
||||||
'HTTP_HOST': DOMAIN,
|
'HTTP_HOST': DOMAIN,
|
||||||
}
|
}
|
||||||
|
@ -57,9 +57,10 @@ class Signature(TestCase):
|
||||||
date=None):
|
date=None):
|
||||||
now = date or http_date()
|
now = date or http_date()
|
||||||
data = get_follow_data(sender, self.rat)
|
data = get_follow_data(sender, self.rat)
|
||||||
|
digest = digest or make_digest(data)
|
||||||
signature = make_signature(
|
signature = make_signature(
|
||||||
signer or sender, self.rat.inbox, now, digest or make_digest(data))
|
signer or sender, self.rat.inbox, now, digest)
|
||||||
return self.send(signature, now, send_data or data)
|
return self.send(signature, now, send_data or data, digest)
|
||||||
|
|
||||||
def test_correct_signature(self):
|
def test_correct_signature(self):
|
||||||
response = self.send_test_request(sender=self.mouse)
|
response = self.send_test_request(sender=self.mouse)
|
||||||
|
|
Loading…
Reference in a new issue