diff --git a/tests/unit/test_ap-gateway.py b/tests/unit/test_ap-gateway.py index ce9598e0..f678db03 100644 --- a/tests/unit/test_ap-gateway.py +++ b/tests/unit/test_ap-gateway.py @@ -823,12 +823,17 @@ class TestActivityPubGateway: 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"