Global reformatting with black.
This commit is contained in:
parent
5ec4fdd787
commit
96bf3af324
68 changed files with 557 additions and 561 deletions
|
|
@ -42,6 +42,7 @@ from libervia.backend.plugins.plugin_comp_email_gateway.pubsub_service import (
|
|||
)
|
||||
from libervia.backend.plugins.plugin_xep_0131 import HeadersData, Urgency
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def email_gw(host):
|
||||
email_gw = EmailGatewayComponent(host)
|
||||
|
|
@ -49,6 +50,7 @@ def email_gw(host):
|
|||
email_gw.users_data = {}
|
||||
return email_gw
|
||||
|
||||
|
||||
class TestEmailGatewayComponent:
|
||||
|
||||
def test_jid_to_email_gateway_jid(self, email_gw):
|
||||
|
|
@ -284,12 +286,26 @@ class TestPubsubService:
|
|||
request.sender = client.jid
|
||||
request.nodeIdentifier = pubsub_resource._pfs.namespace
|
||||
files = [
|
||||
{"id": "1", "name": "file1", "media_type": "application", "media_subtype":
|
||||
"octet-stream", "size": 123, "hash_algo": "sha-256", "file_hash": "0123456789abcdef",
|
||||
"created": 123},
|
||||
{"id": "2", "name": "file2", "media_type": "application", "media_subtype":
|
||||
"octet-stream", "size": 456, "hash_algo": "sha-256", "file_hash": "0123456789abcdef",
|
||||
"created": 123},
|
||||
{
|
||||
"id": "1",
|
||||
"name": "file1",
|
||||
"media_type": "application",
|
||||
"media_subtype": "octet-stream",
|
||||
"size": 123,
|
||||
"hash_algo": "sha-256",
|
||||
"file_hash": "0123456789abcdef",
|
||||
"created": 123,
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"name": "file2",
|
||||
"media_type": "application",
|
||||
"media_subtype": "octet-stream",
|
||||
"size": 456,
|
||||
"hash_algo": "sha-256",
|
||||
"file_hash": "0123456789abcdef",
|
||||
"created": 123,
|
||||
},
|
||||
]
|
||||
host.memory.get_files = AsyncMock(return_value=files)
|
||||
result, _ = await pubsub_resource.items(request)
|
||||
|
|
|
|||
|
|
@ -51,14 +51,13 @@ class TestSQLA:
|
|||
from_jid=None,
|
||||
to_jid=None,
|
||||
filters={"keyword": "test"},
|
||||
profile="test_profile"
|
||||
profile="test_profile",
|
||||
)
|
||||
|
||||
# We check that the SQL query is as expected.
|
||||
executed_stmt = mock_session_instance.execute.call_args[0][0]
|
||||
compiled = executed_stmt.compile(
|
||||
dialect=sqlite.dialect(),
|
||||
compile_kwargs={"literal_binds": True}
|
||||
dialect=sqlite.dialect(), compile_kwargs={"literal_binds": True}
|
||||
)
|
||||
sql = str(compiled)
|
||||
assert "json_each" in sql
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ class TestXEP0215:
|
|||
host.memory.disco.has_feature = AsyncMock()
|
||||
host.memory.disco.has_feature.return_value = True
|
||||
|
||||
|
||||
services_elt = xml_tools.parse(
|
||||
"""
|
||||
<services xmlns="urn:xmpp:extdisco:2">
|
||||
|
|
|
|||
|
|
@ -35,7 +35,9 @@ class TestXEP0461:
|
|||
async def test_reply_to_from_element(self):
|
||||
"""<reply> element parsing works."""
|
||||
# Test correct case
|
||||
element = domish.Element((NS_REPLY, "reply"), attribs={"id": "123", "to": "user@example.com"})
|
||||
element = domish.Element(
|
||||
(NS_REPLY, "reply"), attribs={"id": "123", "to": "user@example.com"}
|
||||
)
|
||||
reply = ReplyTo.from_element(element)
|
||||
assert reply.to == jid.JID("user@example.com")
|
||||
assert reply.id == "123"
|
||||
|
|
@ -92,5 +94,7 @@ class TestXEP0461:
|
|||
mess_data = MessageData(extra={"reply": {"id": "123", "internal_uid": False}})
|
||||
pre_xml_treatments = MagicMock()
|
||||
post_xml_treatments = MagicMock()
|
||||
xep._sendMessage_trigger(client, mess_data, pre_xml_treatments, post_xml_treatments)
|
||||
xep._sendMessage_trigger(
|
||||
client, mess_data, pre_xml_treatments, post_xml_treatments
|
||||
)
|
||||
assert post_xml_treatments.addCallback.called
|
||||
|
|
|
|||
Loading…
Reference in a new issue