mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 19:11:09 +00:00
fix tests and make pylint happier
This commit is contained in:
parent
123628c66a
commit
8a8af4e909
2 changed files with 3 additions and 3 deletions
|
@ -563,9 +563,7 @@ async def sign_and_send(
|
|||
"Failed to send broadcast to %s: %s", destination, response.reason
|
||||
)
|
||||
if kwargs.get("use_legacy_key") is not True:
|
||||
# try with incorrect keyId to enable communication with legacy Bookwyrm servers
|
||||
logger.info("Trying again with legacy keyId header value")
|
||||
|
||||
asyncio.ensure_future(
|
||||
sign_and_send(
|
||||
session, sender, data, destination, use_legacy_key=True
|
||||
|
|
|
@ -111,6 +111,7 @@ class Signature(TestCase):
|
|||
datafile = pathlib.Path(__file__).parent.joinpath("data/ap_user.json")
|
||||
data = json.loads(datafile.read_bytes())
|
||||
data["id"] = self.fake_remote.remote_id
|
||||
data["publicKey"]["id"] = f"{self.fake_remote.remote_id}/#main-key"
|
||||
data["publicKey"]["publicKeyPem"] = self.fake_remote.key_pair.public_key
|
||||
del data["icon"] # Avoid having to return an avatar.
|
||||
responses.add(responses.GET, self.fake_remote.remote_id, json=data, status=200)
|
||||
|
@ -138,6 +139,7 @@ class Signature(TestCase):
|
|||
datafile = pathlib.Path(__file__).parent.joinpath("data/ap_user.json")
|
||||
data = json.loads(datafile.read_bytes())
|
||||
data["id"] = self.fake_remote.remote_id
|
||||
data["publicKey"]["id"] = f"{self.fake_remote.remote_id}/#main-key"
|
||||
data["publicKey"]["publicKeyPem"] = self.fake_remote.key_pair.public_key
|
||||
del data["icon"] # Avoid having to return an avatar.
|
||||
responses.add(responses.GET, self.fake_remote.remote_id, json=data, status=200)
|
||||
|
@ -157,7 +159,7 @@ class Signature(TestCase):
|
|||
"bookwyrm.models.relationship.UserFollowRequest.accept"
|
||||
) as accept_mock:
|
||||
response = self.send_test_request(sender=self.fake_remote)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.status_code, 200) #BUG this is 401
|
||||
self.assertTrue(accept_mock.called)
|
||||
|
||||
# Old key is cached, so still works:
|
||||
|
|
Loading…
Reference in a new issue