Mercurial > libervia-backend
changeset 3808:39fc2e1b3793
tests (unit/ap gateway): fix `onMessage` call following change in the component:
the component now uses the normal message workflow, thus the tests had to be updated
rel 367
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 17 Jun 2022 15:50:34 +0200 |
parents | 2032826cfbcf |
children | 04b57c0b2278 |
files | tests/unit/test_ap-gateway.py |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/unit/test_ap-gateway.py Fri Jun 17 15:50:34 2022 +0200 +++ b/tests/unit/test_ap-gateway.py Fri Jun 17 15:50:34 2022 +0200 @@ -823,12 +823,17 @@ monkeypatch.setattr(plugin_comp_ap_gateway.treq, "get", mock_ap_get) monkeypatch.setattr(plugin_comp_ap_gateway.treq, "json_content", mock_treq_json) monkeypatch.setattr(ap_gateway, "apGet", mock_ap_get) - message_elt = domish.Element((None, "message")) - message_elt.addElement("body", content="This is a test message.") - message_elt["from"] = TEST_JID.full() - message_elt["to"] = ap_gateway.getLocalJIDFromAccount(TEST_AP_ACCOUNT).full() + mess_data = { + "from": TEST_JID, + "to": ap_gateway.getLocalJIDFromAccount(TEST_AP_ACCOUNT), + "type": "chat", + "message": {"": "This is a test message."}, + "extra": { + "origin-id": "123" + } + } with patch.object(ap_gateway, "signAndPost") as signAndPost: - await ap_gateway.onMessage(message_elt) + await ap_gateway.onMessage(ap_gateway.client, mess_data) url, actor_id, doc = signAndPost.call_args[0] assert url == "https://example.org/users/test_user/inbox" assert actor_id == "https://test.example/_ap/actor/some_user%40test.example"