diff tests/unit/test_plugin_xep_0373.py @ 4285:f1d0cde61af7

tests (unit): fix tests + black reformatting.
author Goffi <goffi@goffi.org>
date Sun, 14 Jul 2024 17:42:53 +0200
parents 4b842c1fb686
children
line wrap: on
line diff
--- a/tests/unit/test_plugin_xep_0373.py	Sun Jul 14 16:47:45 2024 +0200
+++ b/tests/unit/test_plugin_xep_0373.py	Sun Jul 14 17:42:53 2024 +0200
@@ -2,6 +2,7 @@
 
 import pytest
 from libervia.backend.core import exceptions
+
 try:
     from libervia.backend.plugins.plugin_xep_0373 import XEP_0373, NS_OX
 except exceptions.MissingModule as e:
@@ -20,7 +21,7 @@
 
 
 def test_signcrypt_element() -> None:
-    signcrypt_elt, payload_elt = XEP_0373.build_signcrypt_element([ a, b ])
+    signcrypt_elt, payload_elt = XEP_0373.build_signcrypt_element([a, b])
     payload_elt.addElement("signcrypt-test-content", content="signcrypt test content")
 
     rpad_elt = next(signcrypt_elt.elements(NS_OX, "rpad"))
@@ -36,11 +37,11 @@
     assert (datetime.now(timezone.utc) - timestamp) < timedelta(seconds=10)
     assert signcrypt_elt.toXml() == (
         "<signcrypt xmlns='urn:xmpp:openpgp:0'>"
-            "<to jid='foo@example.com'/>"
-            "<to jid='bar@example.com'/>"
-            "<payload>"
-                "<signcrypt-test-content>signcrypt test content</signcrypt-test-content>"
-            "</payload>"
+        "<to jid='foo@example.com'/>"
+        "<to jid='bar@example.com'/>"
+        "<payload>"
+        "<signcrypt-test-content>signcrypt test content</signcrypt-test-content>"
+        "</payload>"
         "</signcrypt>"
     )
 
@@ -51,7 +52,7 @@
 
 
 def test_sign_element_with_rpad() -> None:
-    sign_elt, payload_elt = XEP_0373.build_sign_element([ a, b ], True)
+    sign_elt, payload_elt = XEP_0373.build_sign_element([a, b], True)
     payload_elt.addElement("sign-test-content", content="sign test content")
 
     rpad_elt = next(sign_elt.elements(NS_OX, "rpad"))
@@ -67,17 +68,17 @@
     assert (datetime.now(timezone.utc) - timestamp) < timedelta(seconds=10)
     assert sign_elt.toXml() == (
         "<sign xmlns='urn:xmpp:openpgp:0'>"
-            "<to jid='foo@example.com'/>"
-            "<to jid='bar@example.com'/>"
-            "<payload>"
-                "<sign-test-content>sign test content</sign-test-content>"
-            "</payload>"
+        "<to jid='foo@example.com'/>"
+        "<to jid='bar@example.com'/>"
+        "<payload>"
+        "<sign-test-content>sign test content</sign-test-content>"
+        "</payload>"
         "</sign>"
     )
 
 
 def test_sign_element_without_rpad() -> None:
-    sign_elt, payload_elt = XEP_0373.build_sign_element([ a, b ], False)
+    sign_elt, payload_elt = XEP_0373.build_sign_element([a, b], False)
     payload_elt.addElement("sign-test-content", content="sign test content")
 
     rpad_elt = next(sign_elt.elements(NS_OX, "rpad"), None)
@@ -91,17 +92,17 @@
     assert (datetime.now(timezone.utc) - timestamp) < timedelta(seconds=10)
     assert sign_elt.toXml() == (
         "<sign xmlns='urn:xmpp:openpgp:0'>"
-            "<to jid='foo@example.com'/>"
-            "<to jid='bar@example.com'/>"
-            "<payload>"
-                "<sign-test-content>sign test content</sign-test-content>"
-            "</payload>"
+        "<to jid='foo@example.com'/>"
+        "<to jid='bar@example.com'/>"
+        "<payload>"
+        "<sign-test-content>sign test content</sign-test-content>"
+        "</payload>"
         "</sign>"
     )
 
 
 def test_crypt_element_with_recipients() -> None:
-    crypt_elt, payload_elt = XEP_0373.build_crypt_element([ a, b ])
+    crypt_elt, payload_elt = XEP_0373.build_crypt_element([a, b])
     payload_elt.addElement("crypt-test-content", content="crypt test content")
 
     rpad_elt = next(crypt_elt.elements(NS_OX, "rpad"))
@@ -117,11 +118,11 @@
     assert (datetime.now(timezone.utc) - timestamp) < timedelta(seconds=10)
     assert crypt_elt.toXml() == (
         "<crypt xmlns='urn:xmpp:openpgp:0'>"
-            "<to jid='foo@example.com'/>"
-            "<to jid='bar@example.com'/>"
-            "<payload>"
-                "<crypt-test-content>crypt test content</crypt-test-content>"
-            "</payload>"
+        "<to jid='foo@example.com'/>"
+        "<to jid='bar@example.com'/>"
+        "<payload>"
+        "<crypt-test-content>crypt test content</crypt-test-content>"
+        "</payload>"
         "</crypt>"
     )
 
@@ -143,8 +144,8 @@
     assert (datetime.now(timezone.utc) - timestamp) < timedelta(seconds=10)
     assert crypt_elt.toXml() == (
         "<crypt xmlns='urn:xmpp:openpgp:0'>"
-            "<payload>"
-                "<crypt-test-content>crypt test content</crypt-test-content>"
-            "</payload>"
+        "<payload>"
+        "<crypt-test-content>crypt test content</crypt-test-content>"
+        "</payload>"
         "</crypt>"
     )