fix tests and formatting

This commit is contained in:
Hugh Rundle 2023-04-13 22:33:54 +10:00
parent 56a062d01f
commit 123628c66a
4 changed files with 9 additions and 6 deletions

View file

@ -540,7 +540,12 @@ async def sign_and_send(
digest = make_digest(data)
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 = {

View file

@ -22,9 +22,7 @@ def create_key_pair():
return private_key, public_key
def make_signature(
method, sender, destination, date, **kwargs
):
def make_signature(method, sender, destination, date, **kwargs):
"""uses a private key to sign an outgoing message"""
inbox_parts = urlparse(destination)
signature_headers = [

View file

@ -404,7 +404,7 @@ class ModelFields(TestCase):
self.assertIsInstance(result, list)
self.assertEqual(len(result), 1)
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")
def test_tag_field_from_activity(self, *_):

View file

@ -87,7 +87,7 @@ class Signature(TestCase):
data = json.dumps(get_follow_activity(sender, self.rat))
digest = digest or make_digest(data)
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.models.user.set_remote_server.delay"):