diff options
-rw-r--r-- | .gitlab-ci.yml | 15 | ||||
-rw-r--r-- | doap.xml | 517 | ||||
-rw-r--r-- | itests/__init__.py | 0 | ||||
-rw-r--r-- | itests/test_basic_connect_and_message.py | 28 | ||||
-rw-r--r-- | itests/test_muc.py | 78 | ||||
-rwxr-xr-x | run_integration_tests.py | 71 | ||||
-rw-r--r-- | slixmpp/plugins/__init__.py | 29 | ||||
-rw-r--r-- | slixmpp/plugins/xep_0300/hash.py | 20 | ||||
-rw-r--r-- | slixmpp/plugins/xep_0352/csi.py | 13 | ||||
-rw-r--r-- | slixmpp/test/integration.py | 61 | ||||
-rw-r--r-- | slixmpp/xmlstream/xmlstream.py | 17 |
11 files changed, 736 insertions, 113 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e3daa539..3aa76989 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,6 +13,21 @@ test: - pip3 install emoji aiohttp - ./run_tests.py +test_integration: + stage: test + tags: + - docker + image: ubuntu:latest + only: + variables: + - $CI_ACCOUNT1 + - $CI_ACCOUNT2 + script: + - apt update + - apt install -y python3 python3-pip cython3 gpg + - pip3 install emoji aiohttp aiodns + - ./run_integration_tests.py + trigger_poezio: stage: trigger tags: @@ -77,446 +77,670 @@ <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0004.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>2.11.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0009.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>2.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0012.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>2.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0013.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0016.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.7</xmpp:version> + <xmpp:since>1.0</xmpp:since> + <xmpp:note>The XEP is deprecated, we might remove support for it at some point.</xmpp:note> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0020.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.6</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0027.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.4</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0030.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>2.5rc3</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0033.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.2.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0045.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>partial</xmpp:status> + <xmpp:version>1.34.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0047.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>2.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0048.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> + <xmpp:note>The XEP is deprecated, we might remove support for it at some point.</xmpp:note> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0049.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0050.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.3.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0054.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0059.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0060.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>partial</xmpp:status> + <xmpp:version>1.19.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0065.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.8.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0066.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.5</xmpp:version> + <xmpp:since>1.0</xmpp:since> + </xmpp:SupportedXep> + </implements> + <implements> + <xmpp:SupportedXep> + <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0070.html"/> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0.1</xmpp:version> + <xmpp:since>1.2</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0071.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.5.4</xmpp:version> + <xmpp:since>1.0</xmpp:since> + <xmpp:note>This XEP is deprecated, but we have no plan to remove support for it.</xmpp:note> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0077.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>2.4</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0078.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>2.5</xmpp:version> + <xmpp:since>1.0</xmpp:since> + <xmpp:note>This XEP is obsolete, we are considering removing support for it.</xmpp:note> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0079.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0080.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.9</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0082.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0084.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.1.4</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0085.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>2.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0086.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> + <xmpp:note>The XEP is deprecated, we might remove support for it at some point.</xmpp:note> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0091.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.4</xmpp:version> + <xmpp:since>1.0</xmpp:since> + <xmpp:note>This XEP is obsolete, we are considering removing support for it.</xmpp:note> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0092.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> + </xmpp:SupportedXep> + </implements> + <implements> + <xmpp:SupportedXep> + <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0095.html"/> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> + <xmpp:note>The XEP is deprecated, we might remove support for it at some point.</xmpp:note> + </xmpp:SupportedXep> + </implements> + <implements> + <xmpp:SupportedXep> + <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0096.html"/> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.3</xmpp:version> + <xmpp:since>1.0</xmpp:since> + <xmpp:note>The XEP is deprecated, we might remove support for it at some point.</xmpp:note> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0106.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.1.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0107.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.2.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0108.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.3</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0115.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.5.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0118.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.3.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0122.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0.2</xmpp:version> + <xmpp:since>1.1</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0128.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0131.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0133.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> + </xmpp:SupportedXep> + </implements> + <implements> + <xmpp:SupportedXep> + <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0138.html"/> + <xmpp:status>complete</xmpp:status> + <xmpp:version>2.0</xmpp:version> + <xmpp:since>1.1</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0152.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0153.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0163.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.2.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0172.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0184.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.4.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0186.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.14.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0191.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.3</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0196.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.3</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0198.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.6</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0199.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>2.0.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0202.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>2.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0203.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>2.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0221.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0222.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0223.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0224.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0231.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0235.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.7</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0242.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> + <xmpp:note>This XEP is obsolete, we are considering removing support for it.</xmpp:note> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0249.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0256.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.1</xmpp:version> + <xmpp:since>1.2</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0257.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.3</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0258.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.1.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0270.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> + <xmpp:note>This XEP is obsolete, we are considering removing support for it.</xmpp:note> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0279.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0280.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.13.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0297.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> + </xmpp:SupportedXep> + </implements> + <implements> + <xmpp:SupportedXep> + <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0300.html"/> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0.0</xmpp:version> + <xmpp:since>1.3.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0302.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.1</xmpp:version> + <xmpp:since>1.0</xmpp:since> + <xmpp:note>This XEP is obsolete, we are considering removing support for it.</xmpp:note> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0308.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.2.0</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0313.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.7.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0319.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0.2</xmpp:version> + <xmpp:since>1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0323.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.6</xmpp:version> + <xmpp:since>1.0</xmpp:since> + <xmpp:note>This XEP has been retracted, we are considering removing support for it.</xmpp:note> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0325.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.5</xmpp:version> + <xmpp:since>1.0</xmpp:since> + <xmpp:note>This XEP has been retracted, we are considering removing support for it.</xmpp:note> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> - <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0359.html"/> + <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0332.html"/> <xmpp:status>complete</xmpp:status> - <xmpp:since>NEXT</xmpp:since> + <xmpp:version>0.5.1</xmpp:version> + <xmpp:since>1.1</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> - <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0332.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0333.html"/> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.4</xmpp:version> + <xmpp:since>1.2</xmpp:since> + </xmpp:SupportedXep> + </implements> + <implements> + <xmpp:SupportedXep> + <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0334.html"/> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.3.0</xmpp:version> + <xmpp:since>1.2</xmpp:since> + </xmpp:SupportedXep> + </implements> + <implements> + <xmpp:SupportedXep> + <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0335.html"/> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.1.1</xmpp:version> + <xmpp:since>1.5.0</xmpp:since> + </xmpp:SupportedXep> + </implements> + <implements> + <xmpp:SupportedXep> + <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0352.html"/> + <xmpp:status>complete</xmpp:status> + <xmpp:version>1.0.0</xmpp:version> + <xmpp:since>1.2</xmpp:since> </xmpp:SupportedXep> </implements> <implements> @@ -528,14 +752,15 @@ </xmpp:SupportedXep> </implements> <implements> - <xmpp:supportedxep> + <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0359.html"/> <xmpp:status>complete</xmpp:status> + <xmpp:version>0.6.1</xmpp:version> <xmpp:since>NEXT</xmpp:since> </xmpp:SupportedXep> </implements> <implements> - <xmpp:supportedxep> + <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0363.html"/> <xmpp:status>complete</xmpp:status> <xmpp:version>1.0.0</xmpp:version> @@ -546,19 +771,39 @@ <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0369.html"/> <xmpp:status>partial</xmpp:status> + <xmpp:version>0.14.6</xmpp:version> <xmpp:since>NEXT</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0377.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.2</xmpp:version> + <xmpp:since>NEXT</xmpp:since> + </xmpp:SupportedXep> + </implements> + <implements> + <xmpp:SupportedXep> + <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0380.html"/> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.3.0</xmpp:version> + <xmpp:since>1.3.0</xmpp:since> + </xmpp:SupportedXep> + </implements> + <implements> + <xmpp:SupportedXep> + <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0394.html"/> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.2.1</xmpp:version> + <xmpp:since>1.3.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0403.html"/> <xmpp:status>partial</xmpp:status> + <xmpp:version>0.3.2</xmpp:version> <xmpp:since>NEXT</xmpp:since> </xmpp:SupportedXep> </implements> @@ -566,6 +811,7 @@ <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0404.html"/> <xmpp:status>partial</xmpp:status> + <xmpp:version>0.3.1</xmpp:version> <xmpp:since>NEXT</xmpp:since> </xmpp:SupportedXep> </implements> @@ -573,19 +819,23 @@ <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0405.html"/> <xmpp:status>partial</xmpp:status> + <xmpp:version>0.5.1</xmpp:version> <xmpp:since>NEXT</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0421.html"/> - <xmpp:status>unknown</xmpp:status> + <xmpp:status>complete</xmpp:status> + <xmpp:version>0.1.0</xmpp:version> + <xmpp:since>NEXT</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0422.html"/> <xmpp:status>complete</xmpp:status> + <xmpp:version>0.2.0</xmpp:version> <xmpp:since>NEXT</xmpp:since> </xmpp:SupportedXep> </implements> @@ -593,6 +843,7 @@ <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0424.html"/> <xmpp:status>complete</xmpp:status> + <xmpp:version>0.3.0</xmpp:version> <xmpp:since>NEXT</xmpp:since> </xmpp:SupportedXep> </implements> @@ -600,6 +851,7 @@ <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0425.html"/> <xmpp:status>complete</xmpp:status> + <xmpp:version>0.2.1</xmpp:version> <xmpp:since>NEXT</xmpp:since> </xmpp:SupportedXep> </implements> @@ -607,6 +859,7 @@ <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0428.html"/> <xmpp:status>complete</xmpp:status> + <xmpp:version>0.1.1</xmpp:version> <xmpp:since>NEXT</xmpp:since> </xmpp:SupportedXep> </implements> @@ -614,26 +867,116 @@ <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0439.html"/> <xmpp:status>complete</xmpp:status> + <xmpp:version>0.1.0</xmpp:version> <xmpp:since>NEXT</xmpp:since> - <xmpp:vaersion>0.1.0</xmpp:since> </xmpp:SupportedXep> </implements> <implements> <xmpp:SupportedXep> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0444.html"/> <xmpp:status>complete</xmpp:status> - <xmpp:since>0.1.0</xmpp:since> + <xmpp:version>0.1.0</xmpp:version> + <xmpp:since>NEXT</xmpp:since> </xmpp:SupportedXep> </implements> - <!-- Figure out releases. <release> <Version> - <revision>0.5</revision> - <created>2010-02-01</created> - <file-release rdf:resource="https://dev.louiz.org/attachments/29/poezio-0.5.tar.bz2"/> + <revision>1.0</revision> + <created>2015-07-31</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/e7/cc/d102dee9d4cf93e24ffcf6c43c3b50e2615c2ee4514e5fd160d96b9fe536/slixmpp-1.0.post5.tar.gz"/> + </Version> + </release> + <release> + <Version> + <revision>1.1</revision> + <created>2015-10-02</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/2a/8a/cb032a938bf245decc88aec2f2e03401802766a1a97f9daf3bf7fee5b07f/slixmpp-1.1.tar.gz"/> + </Version> + </release> + <release> + <Version> + <revision>1.2</revision> + <created>2016-10-02</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/c2/9f/1ac5304ab1801b08c20b07ee658583abdce9b7ae47ea3faf0d062e86221b/slixmpp-1.2.tar.gz"/> + </Version> + </release> + <release> + <Version> + <revision>1.2.1</revision> + <created>2016-10-05</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/73/7e/072aca82a2f8e25a93ce8755553f36e82975e950f23a69dc10164a23f32f/slixmpp-1.2.1.tar.gz"/> + </Version> + </release> + <release> + <Version> + <revision>1.2.2</revision> + <created>2016-11-21</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/8f/96/19c610e3b42baa140572bb3c79723902ae608bec8d3f0fa3cb187a5c12ba/slixmpp-1.2.2.tar.gz"/> + </Version> + </release> + <release> + <Version> + <revision>1.2.3</revision> + <created>2016-12-07</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/91/af/4018e1fda624af97d4e8fb37ff2cf2744926c126285488c55a5ad1f755da/slixmpp-1.2.3.tar.gz"/> + </Version> + </release> + <release> + <Version> + <revision>1.2.4</revision> + <created>2017-01-30</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/49/bb/092f0c07d6f7ac6922ceea57155c24561af7ee0736c15e7f833ab916c06e/slixmpp-1.2.4.post1.tar.gz"/> + </Version> + </release> + <release> + <Version> + <revision>1.3.0</revision> + <created>2017-11-28</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/84/df/c0972daaca550d98b313e0029dc7158b1b10e120f510917a3d34b5b5f102/slixmpp-1.3.0.tar.gz"/> + </Version> + </release> + <release> + <Version> + <revision>1.4.0</revision> + <created>2018-08-12</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/0a/50/76a06d929668252244a1cef515c48c21403a72988c20cab2f74ef0b4ecbd/slixmpp-1.4.0.tar.gz"/> + </Version> + </release> + <release> + <Version> + <revision>1.4.1</revision> + <created>2018-10-28</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/c6/d3/ed986188026843e0b98de816ab8f4d91a61865db8d4a9162f10596f5431e/slixmpp-1.4.1.tar.gz"/> + </Version> + </release> + <release> + <Version> + <revision>1.4.2</revision> + <created>2019-01-31</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/69/8f/1fa625d035af93bd3dd72589e33e3ff1954bdd37546bedc9246d048b0c93/slixmpp-1.4.2.tar.gz"/> + </Version> + </release> + <release> + <Version> + <revision>1.5.0</revision> + <created>2020-05-01</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/35/6c/cda25435be70821def0013c3d41761ea42c11a0c4e33b8cbca0206a21381/slixmpp-1.5.0.tar.gz"/> + </Version> + </release> + <release> + <Version> + <revision>1.5.1</revision> + <created>2020-05-02</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/2c/37/fbc95dd3632cbdb0d6dcc44e9df51b195fc7793e6beb2059f697dd458dd2/slixmpp-1.5.1.tar.gz"/> + </Version> + </release> + <release> + <Version> + <revision>1.5.2</revision> + <created>2020-05-23</created> + <file-release rdf:resource="https://files.pythonhosted.org/packages/ce/f1/b7cb0ba0b2f9950d3bd8e4d256502c39ac731136e1744c926f67e2c21131/slixmpp-1.5.2.tar.gz"/> </Version> </release> - --> </Project> </rdf:RDF> diff --git a/itests/__init__.py b/itests/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/itests/__init__.py diff --git a/itests/test_basic_connect_and_message.py b/itests/test_basic_connect_and_message.py new file mode 100644 index 00000000..79ad37be --- /dev/null +++ b/itests/test_basic_connect_and_message.py @@ -0,0 +1,28 @@ +import unittest +from slixmpp.test.integration import SlixIntegration + + +class TestConnect(SlixIntegration): + async def asyncSetUp(self): + await super().asyncSetUp() + self.add_client( + self.envjid('CI_ACCOUNT1'), + self.envstr('CI_ACCOUNT1_PASSWORD'), + ) + self.add_client( + self.envjid('CI_ACCOUNT2'), + self.envstr('CI_ACCOUNT2_PASSWORD'), + ) + await self.connect_clients() + + async def test_send_message(self): + """Make sure we can send and receive messages""" + msg = self.clients[0].make_message( + mto=self.clients[1].boundjid, mbody='Msg body', + ) + msg.send() + message = await self.clients[1].wait_until('message') + self.assertEqual(message['body'], msg['body']) + + +suite = unittest.TestLoader().loadTestsFromTestCase(TestConnect) diff --git a/itests/test_muc.py b/itests/test_muc.py new file mode 100644 index 00000000..3dc91955 --- /dev/null +++ b/itests/test_muc.py @@ -0,0 +1,78 @@ +import asyncio +import unittest +from uuid import uuid4 +from slixmpp import JID +from slixmpp.test.integration import SlixIntegration + +UNIQUE = uuid4().hex + + +class TestConnect(SlixIntegration): + + async def asyncSetUp(self): + self.mucserver = self.envjid('CI_MUC_SERVER') + self.muc = JID('%s@%s' % (UNIQUE, self.mucserver)) + self.add_client( + self.envjid('CI_ACCOUNT1'), + self.envstr('CI_ACCOUNT1_PASSWORD'), + ) + self.add_client( + self.envjid('CI_ACCOUNT2'), + self.envstr('CI_ACCOUNT2_PASSWORD'), + ) + self.register_plugins(['xep_0045']) + await self.connect_clients() + + async def test_initial_join(self): + """Check that we can connect to a new muc""" + self.clients[0]['xep_0045'].join_muc(self.muc, 'client1') + presence = await self.clients[0].wait_until('muc::%s::got_online' % self.muc) + self.assertEqual(presence['muc']['affiliation'], 'owner') + + async def test_setup_muc(self): + """Check that sending the initial room config and affiliation list works""" + self.clients[0]['xep_0045'].join_muc(self.muc, 'client1') + presence = await self.clients[0].wait_until('muc::%s::got_online' % self.muc) + self.assertEqual(presence['muc']['affiliation'], 'owner') + # Send initial configuration + config = await self.clients[0]['xep_0045'].get_room_config(self.muc) + values = config.get_values() + values['muc#roomconfig_persistentroom'] = False + values['muc#roomconfig_membersonly'] = True + config['values'] = values + config.reply() + config = await self.clients[0]['xep_0045'].set_room_config(self.muc, config) + + # Send affiliation list including client 2 + await self.clients[0]['xep_0045'].send_affiliation_list( + self.muc, + [ + (self.clients[1].boundjid.bare, 'member'), + ], + ) + + async def test_join_after_config(self): + """Join a room after being added to the affiliation list""" + await self.test_setup_muc() + self.clients[1]['xep_0045'].join_muc(self.muc, 'client2') + await self.clients[1].wait_until('muc::%s::got_online' % self.muc) + + async def test_leave(self): + """Check that we leave properly""" + await self.test_join_after_config() + self.clients[0]['xep_0045'].leave_muc(self.muc, 'client1', 'boooring') + pres = await self.clients[1].wait_until('muc::%s::got_offline' % self.muc) + self.assertEqual(pres['status'], 'boooring') + self.assertEqual(pres['type'], 'unavailable') + + + async def test_kick(self): + """Test kicking a user""" + await self.test_join_after_config() + await asyncio.gather( + self.clients[0].wait_until('muc::%s::got_offline' % self.muc), + self.clients[0]['xep_0045'].set_role(self.muc, 'client2', 'none') + ) + + +suite = unittest.TestLoader().loadTestsFromTestCase(TestConnect) diff --git a/run_integration_tests.py b/run_integration_tests.py new file mode 100755 index 00000000..9f670b5c --- /dev/null +++ b/run_integration_tests.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 + +import sys +import logging +import unittest + +from argparse import ArgumentParser +from distutils.core import Command +from importlib import import_module +from pathlib import Path + + +def run_tests(filenames=None): + """ + Find and run all tests in the tests/ directory. + + Excludes live tests (tests/live_*). + """ + if sys.version_info < (3, 8): + raise ValueError('Your python version is too old to run these tests') + if not filenames: + filenames = [i for i in Path('itests').glob('test_*')] + else: + filenames = [Path(i) for i in filenames] + + modules = ['.'.join(test.parts[:-1] + (test.stem,)) for test in filenames] + + suites = [] + for filename in modules: + module = import_module(filename) + suites.append(module.suite) + + tests = unittest.TestSuite(suites) + runner = unittest.TextTestRunner(verbosity=2) + + # Disable logging output + logging.basicConfig(level=100) + logging.disable(100) + + result = runner.run(tests) + return result + + +# Add a 'test' command for setup.py + +class TestCommand(Command): + + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + run_tests() + + +if __name__ == '__main__': + parser = ArgumentParser(description='Run unit tests.') + parser.add_argument('tests', metavar='TEST', nargs='*', help='list of tests to run, or nothing to run them all') + args = parser.parse_args() + + result = run_tests(args.tests) + print("<tests %s ran='%s' errors='%s' fails='%s' success='%s'/>" % ( + "xmlns='http//andyet.net/protocol/tests'", + result.testsRun, len(result.errors), + len(result.failures), result.wasSuccessful())) + + sys.exit(not result.wasSuccessful()) diff --git a/slixmpp/plugins/__init__.py b/slixmpp/plugins/__init__.py index 02ac3712..f37fdcfb 100644 --- a/slixmpp/plugins/__init__.py +++ b/slixmpp/plugins/__init__.py @@ -16,14 +16,14 @@ __all__ = [ 'xep_0009', # Jabber-RPC 'xep_0012', # Last Activity 'xep_0013', # Flexible Offline Message Retrieval - 'xep_0016', # Privacy Lists +# 'xep_0016', # Privacy Lists. Don’t automatically load 'xep_0020', # Feature Negotiation 'xep_0027', # Current Jabber OpenPGP Usage 'xep_0030', # Service Discovery 'xep_0033', # Extended Stanza Addresses 'xep_0045', # Multi-User Chat (Client) 'xep_0047', # In-Band Bytestreams - 'xep_0048', # Bookmarks +# 'xep_0048', # Legacy Bookmarks. Don’t automatically load 'xep_0049', # Private XML Storage 'xep_0050', # Ad-hoc Commands 'xep_0054', # vcard-temp @@ -31,17 +31,20 @@ __all__ = [ 'xep_0060', # Pubsub (Client) 'xep_0065', # SOCKS5 Bytestreams 'xep_0066', # Out of Band Data + 'xep_0070', # Verifying HTTP Requests via XMPP 'xep_0071', # XHTML-IM 'xep_0077', # In-Band Registration -# 'xep_0078', # Non-SASL auth. Don't automatically load +# 'xep_0078', # Non-SASL auth. Don’t automatically load 'xep_0079', # Advanced Message Processing 'xep_0080', # User Location 'xep_0082', # XMPP Date and Time Profiles 'xep_0084', # User Avatar 'xep_0085', # Chat State Notifications 'xep_0086', # Legacy Error Codes - 'xep_0091', # Legacy Delayed Delivery +# 'xep_0091', # Legacy Delayed Delivery. Don’t automatically load 'xep_0092', # Software Version +# 'xep_0095', # Legacy Stream Initiation. Don’t automatically load +# 'xep_0096', # Legacy SI File Transfer. Don’t automatically load 'xep_0106', # JID Escaping 'xep_0107', # User Mood 'xep_0108', # User Activity @@ -51,6 +54,7 @@ __all__ = [ 'xep_0128', # Extended Service Discovery 'xep_0131', # Standard Headers and Internet Metadata 'xep_0133', # Service Administration +# 'xep_0138', # Stream Compression. Broken atm 'xep_0152', # Reachability Addresses 'xep_0153', # vCard-Based Avatars 'xep_0163', # Personal Eventing Protocol @@ -69,27 +73,34 @@ __all__ = [ 'xep_0224', # Attention 'xep_0231', # Bits of Binary 'xep_0235', # OAuth Over XMPP - 'xep_0242', # XMPP Client Compliance 2009 +# 'xep_0242', # XMPP Client Compliance 2009. Don’t automatically load 'xep_0249', # Direct MUC Invitations 'xep_0256', # Last Activity in Presence 'xep_0257', # Client Certificate Management for SASL EXTERNAL 'xep_0258', # Security Labels in XMPP - 'xep_0270', # XMPP Compliance Suites 2010 +# 'xep_0270', # XMPP Compliance Suites 2010. Don’t automatically load 'xep_0279', # Server IP Check 'xep_0280', # Message Carbons 'xep_0297', # Stanza Forwarding - 'xep_0302', # XMPP Compliance Suites 2012 + 'xep_0300', # Use of Cryptographic Hash Functions in XMPP +# 'xep_0302', # XMPP Compliance Suites 2012. Don’t automatically load 'xep_0308', # Last Message Correction 'xep_0313', # Message Archive Management 'xep_0319', # Last User Interaction in Presence - 'xep_0323', # IoT Systems Sensor Data - 'xep_0325', # IoT Systems Control +# 'xep_0323', # IoT Systems Sensor Data. Don’t automatically load +# 'xep_0325', # IoT Systems Control. Don’t automatically load 'xep_0332', # HTTP Over XMPP Transport + 'xep_0333', # Chat Markers + 'xep_0334', # Message Processing Hints + 'xep_0335', # JSON Containers + 'xep_0352', # Client State Indication 'xep_0353', # Jingle Message Initiation 'xep_0359', # Unique and Stable Stanza IDs 'xep_0363', # HTTP File Upload 'xep_0369', # MIX-CORE 'xep_0377', # Spam reporting + 'xep_0380', # Explicit Message Encryption + 'xep_0394', # Message Markup 'xep_0403', # MIX-Presence 'xep_0404', # MIX-Anon 'xep_0405', # MIX-PAM diff --git a/slixmpp/plugins/xep_0300/hash.py b/slixmpp/plugins/xep_0300/hash.py index 6095671d..75252d0c 100644 --- a/slixmpp/plugins/xep_0300/hash.py +++ b/slixmpp/plugins/xep_0300/hash.py @@ -39,25 +39,22 @@ class XEP_0300(BasePlugin): 'sha-1': hashlib.sha1, 'sha-256': hashlib.sha256, 'sha-512': hashlib.sha512, - 'sha3-256': lambda: hashlib.sha3_256(), - 'sha3-512': lambda: hashlib.sha3_512(), + 'sha3-256': hashlib.sha3_256, + 'sha3-512': hashlib.sha3_512, 'BLAKE2b256': lambda: hashlib.blake2b(digest_size=32), 'BLAKE2b512': lambda: hashlib.blake2b(digest_size=64), } + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.enabled_hashes = [] + def plugin_init(self): namespace = 'urn:xmpp:hash-function-text-names:%s' - self.enabled_hashes = [] + self.enabled_hashes.clear() for algo in self._hashlib_function: if getattr(self, 'enable_' + algo, False): - # XXX: this is a hack for Python 3.5 or below, which - # don’t support sha3 or blake2b… - try: - self._hashlib_function[algo]() - except AttributeError: - log.warn('Algorithm %s unavailable, disabling.', algo) - else: - self.enabled_hashes.append(namespace % algo) + self.enabled_hashes.append(namespace % algo) def session_bind(self, jid): self.xmpp['xep_0030'].add_feature(Hash.namespace) @@ -68,6 +65,7 @@ class XEP_0300(BasePlugin): def plugin_end(self): for namespace in self.enabled_hashes: self.xmpp['xep_0030'].del_feature(namespace) + self.enabled_hashes.clear() self.xmpp['xep_0030'].del_feature(feature=Hash.namespace) diff --git a/slixmpp/plugins/xep_0352/csi.py b/slixmpp/plugins/xep_0352/csi.py index 93295b84..21bfe371 100644 --- a/slixmpp/plugins/xep_0352/csi.py +++ b/slixmpp/plugins/xep_0352/csi.py @@ -8,6 +8,7 @@ import logging +from slixmpp import ClientXMPP from slixmpp.stanza import StreamFeatures from slixmpp.xmlstream import register_stanza_plugin from slixmpp.plugins.base import BasePlugin @@ -40,17 +41,19 @@ class XEP_0352(BasePlugin): self.xmpp.register_stanza(stanza.Active) self.xmpp.register_stanza(stanza.Inactive) - self.xmpp.register_feature('csi', - self._handle_csi_feature, - restart=False, - order=self.order) + if isinstance(self.xmpp, ClientXMPP): + self.xmpp.register_feature('csi', + self._handle_csi_feature, + restart=False, + order=self.order) def plugin_end(self): if self.xmpp.is_component: return - self.xmpp.unregister_feature('csi', self.order) + if isinstance(self.xmpp, ClientXMPP): + self.xmpp.unregister_feature('csi', self.order) self.xmpp.remove_stanza(stanza.Active) self.xmpp.remove_stanza(stanza.Inactive) diff --git a/slixmpp/test/integration.py b/slixmpp/test/integration.py new file mode 100644 index 00000000..d15019cc --- /dev/null +++ b/slixmpp/test/integration.py @@ -0,0 +1,61 @@ +""" + Slixmpp: The Slick XMPP Library + Copyright (C) 2020 Mathieu Pasquet + This file is part of Slixmpp. + + See the file LICENSE for copying permission. +""" + +import asyncio +import os +try: + from unittest import IsolatedAsyncioTestCase +except ImportError: + # Python < 3.8 + # just to make sure the imports do not break, but + # not usable. + from unittest import TestCase as IsolatedAsyncioTestCase +from typing import ( + List, +) + +from slixmpp import JID +from slixmpp.clientxmpp import ClientXMPP + + +class SlixIntegration(IsolatedAsyncioTestCase): + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.clients = [] + self.addAsyncCleanup(self._destroy) + + def envjid(self, name): + """Get a JID from an env var""" + value = os.getenv(name) + return JID(value) + + def envstr(self, name): + """get a str from an env var""" + return os.getenv(name) + + def register_plugins(self, plugins: List[str]): + """Register plugins on all known clients""" + for plugin in plugins: + for client in self.clients: + client.register_plugin(plugin) + + def add_client(self, jid: JID, password: str): + """Register a new client""" + self.clients.append(ClientXMPP(jid, password)) + + async def connect_clients(self): + """Connect all clients""" + for client in self.clients: + client.connect() + await client.wait_until('session_start') + + async def _destroy(self): + """Kill all clients""" + for client in self.clients: + client.abort() diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py index af494903..066d84df 100644 --- a/slixmpp/xmlstream/xmlstream.py +++ b/slixmpp/xmlstream/xmlstream.py @@ -12,7 +12,7 @@ :license: MIT, see LICENSE for more details """ -from typing import Optional, Set, Callable +from typing import Optional, Set, Callable, Any import functools import logging @@ -1130,3 +1130,18 @@ class XMLStream(asyncio.BaseProtocol): :param exception: An unhandled exception object. """ pass + + async def wait_until(self, event: str, timeout=30) -> Any: + """Utility method to wake on the next firing of an event. + (Registers a disposable handler on it) + + :param str event: Event to wait on. + :param int timeout: Timeout + """ + fut = asyncio.Future() + self.add_event_handler( + event, + fut.set_result, + disposable=True, + ) + return await asyncio.wait_for(fut, timeout) |