Fix #658: Support blind key rotation in HTTP Signatures

This commit is contained in:
Eliot Berriot 2019-01-11 11:04:11 +01:00
parent 8c578fa9f5
commit 5fe30cf59b
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
9 changed files with 162 additions and 12 deletions

View file

@ -266,3 +266,20 @@ def test_purge_actors(factories, mocker):
handle_purge_actors.assert_called_once_with(
ids=[to_delete.pk, to_delete_domain.pk], only=["hello"]
)
def test_rotate_actor_key(factories, settings, mocker):
actor = factories["federation.Actor"](local=True)
get_key_pair = mocker.patch(
"funkwhale_api.federation.keys.get_key_pair",
return_value=(b"private", b"public"),
)
tasks.rotate_actor_key(actor_id=actor.pk)
actor.refresh_from_db()
get_key_pair.assert_called_once_with()
assert actor.public_key == "public"
assert actor.private_key == "private"