# HG changeset patch # User Goffi # Date 1655473834 -7200 # Node ID 39fc2e1b37939517fe4d53c8f44f7dacf3993218 # Parent 2032826cfbcfa3a38c18aec97dc38c02f45e26d1 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 diff -r 2032826cfbcf -r 39fc2e1b3793 tests/unit/test_ap-gateway.py --- 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"