Mercurial > libervia-backend
comparison tests/unit/test_plugin_xep_0420.py @ 3933:cecf45416403
plugin XEP-0373 and XEP-0374: Implementation of OX and OXIM:
GPGME is used as the GPG provider.
rel 374
author | Syndace <me@syndace.dev> |
---|---|
date | Tue, 20 Sep 2022 16:22:18 +0200 |
parents | 8289ac1b34f4 |
children | 4b842c1fb686 |
comparison
equal
deleted
inserted
replaced
3932:7af29260ecb8 | 3933:cecf45416403 |
---|---|
18 | 18 |
19 from datetime import datetime, timezone | 19 from datetime import datetime, timezone |
20 from typing import Callable, cast | 20 from typing import Callable, cast |
21 | 21 |
22 import pytest | 22 import pytest |
23 from sat.core import exceptions | |
23 | 24 |
24 from sat.plugins.plugin_xep_0334 import NS_HINTS | 25 from sat.plugins.plugin_xep_0334 import NS_HINTS |
25 from sat.plugins.plugin_xep_0420 import ( | 26 from sat.plugins.plugin_xep_0420 import ( |
26 NS_SCE, XEP_0420, AffixVerificationFailed, ProfileRequirementsNotMet, SCEAffixPolicy, | 27 NS_SCE, XEP_0420, AffixVerificationFailed, ProfileRequirementsNotMet, SCEAffixPolicy, |
27 SCECustomAffix, SCEProfile | 28 SCECustomAffix, SCEProfile |
433 If a custom affix is included in the envelope, but not excpected by the | 434 If a custom affix is included in the envelope, but not excpected by the |
434 recipient, the schema validation should fail. | 435 recipient, the schema validation should fail. |
435 </body> | 436 </body> |
436 </message>""") | 437 </message>""") |
437 | 438 |
438 with pytest.raises(ValueError): | 439 with pytest.raises(exceptions.ParsingError): |
439 XEP_0420.unpack_stanza( | 440 XEP_0420.unpack_stanza( |
440 unpacking_profile, | 441 unpacking_profile, |
441 stanza, | 442 stanza, |
442 XEP_0420.pack_stanza(packing_profile, stanza) | 443 XEP_0420.pack_stanza(packing_profile, stanza) |
443 ) | 444 ) |
556 <store xmlns="urn:xmpp:hints"/> | 557 <store xmlns="urn:xmpp:hints"/> |
557 </content> | 558 </content> |
558 <unknown-affix unknown-attr="unknown"/> | 559 <unknown-affix unknown-attr="unknown"/> |
559 </envelope>""".encode("utf-8") | 560 </envelope>""".encode("utf-8") |
560 | 561 |
561 with pytest.raises(ValueError): | 562 with pytest.raises(exceptions.ParsingError): |
562 XEP_0420.unpack_stanza(profile, stanza, envelope_serialized) | 563 XEP_0420.unpack_stanza(profile, stanza, envelope_serialized) |