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
This commit is contained in:
parent
c02dcf3d94
commit
847780b473
1 changed files with 10 additions and 5 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in a new issue