mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 19:11:09 +00:00
fix tests and formatting
This commit is contained in:
parent
56a062d01f
commit
123628c66a
4 changed files with 9 additions and 6 deletions
|
@ -540,7 +540,12 @@ async def sign_and_send(
|
||||||
|
|
||||||
digest = make_digest(data)
|
digest = make_digest(data)
|
||||||
signature = make_signature(
|
signature = make_signature(
|
||||||
"post", sender, destination, now, digest=digest, use_legacy_key=kwargs.get("use_legacy_key")
|
"post",
|
||||||
|
sender,
|
||||||
|
destination,
|
||||||
|
now,
|
||||||
|
digest=digest,
|
||||||
|
use_legacy_key=kwargs.get("use_legacy_key"),
|
||||||
)
|
)
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
|
|
|
@ -22,9 +22,7 @@ def create_key_pair():
|
||||||
return private_key, public_key
|
return private_key, public_key
|
||||||
|
|
||||||
|
|
||||||
def make_signature(
|
def make_signature(method, sender, destination, date, **kwargs):
|
||||||
method, sender, destination, date, **kwargs
|
|
||||||
):
|
|
||||||
"""uses a private key to sign an outgoing message"""
|
"""uses a private key to sign an outgoing message"""
|
||||||
inbox_parts = urlparse(destination)
|
inbox_parts = urlparse(destination)
|
||||||
signature_headers = [
|
signature_headers = [
|
||||||
|
|
|
@ -404,7 +404,7 @@ class ModelFields(TestCase):
|
||||||
self.assertIsInstance(result, list)
|
self.assertIsInstance(result, list)
|
||||||
self.assertEqual(len(result), 1)
|
self.assertEqual(len(result), 1)
|
||||||
self.assertEqual(result[0].href, "https://e.b/c")
|
self.assertEqual(result[0].href, "https://e.b/c")
|
||||||
self.assertEqual(result[0].name, "Name")
|
self.assertEqual(result[0].name, "@Name")
|
||||||
self.assertEqual(result[0].type, "Serializable")
|
self.assertEqual(result[0].type, "Serializable")
|
||||||
|
|
||||||
def test_tag_field_from_activity(self, *_):
|
def test_tag_field_from_activity(self, *_):
|
||||||
|
|
|
@ -87,7 +87,7 @@ class Signature(TestCase):
|
||||||
data = json.dumps(get_follow_activity(sender, self.rat))
|
data = json.dumps(get_follow_activity(sender, self.rat))
|
||||||
digest = digest or make_digest(data)
|
digest = digest or make_digest(data)
|
||||||
signature = make_signature(
|
signature = make_signature(
|
||||||
"post", signer or sender, self.rat.inbox, now, digest
|
"post", signer or sender, self.rat.inbox, now, digest=digest
|
||||||
)
|
)
|
||||||
with patch("bookwyrm.views.inbox.activity_task.apply_async"):
|
with patch("bookwyrm.views.inbox.activity_task.apply_async"):
|
||||||
with patch("bookwyrm.models.user.set_remote_server.delay"):
|
with patch("bookwyrm.models.user.set_remote_server.delay"):
|
||||||
|
|
Loading…
Reference in a new issue