slidge.util.test
#
Module Contents#
Classes#
A Slixmpp specific TestCase class that provides |
|
A Slixmpp specific TestCase class that provides |
Functions#
|
|
|
|
Reset registered subclasses between test classes. |
|
- class slidge.util.test.SlixTestPlus(*args, **kwargs)[source]#
Bases:
slixmpp.test.SlixTest
A Slixmpp specific TestCase class that provides methods for comparing message, iq, and presence stanzas.
- Methods:
Message – Create a Message stanza object. Iq – Create an Iq stanza object. Presence – Create a Presence stanza object. check_jid – Check a JID and its component parts. check – Compare a stanza against an XML string. stream_start – Initialize a dummy XMPP client. stream_close – Disconnect the XMPP client. make_header – Create a stream header. send_header – Check that the given header has been sent. send_feature – Send a raw XML element. send – Check that the XMPP client sent the given
generic stanza.
- recv – Queue data for XMPP client to receive, or
verify the data that was received from a live connection.
- recv_header – Check that a given stream header
was received.
- recv_feature – Check that a given, raw XML element
was recveived.
fix_namespaces – Add top-level namespace to an XML object. compare – Compare XML objects against each other.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- check(stanza, criteria, method='exact', defaults=None, use_values=True)[source]#
Create and compare several stanza objects to a correct XML string.
If use_values is False, tests using stanza.values will not be used.
Some stanzas provide default values for some interfaces, but these defaults can be problematic for testing since they can easily be forgotten when supplying the XML string. A list of interfaces that use defaults may be provided and the generated stanzas will use the default values for those interfaces if needed.
However, correcting the supplied XML is not possible for interfaces that add or remove XML elements. Only interfaces that map to XML attributes may be set using the defaults parameter. The supplied XML must take into account any extra elements that are included by default.
- Arguments:
stanza – The stanza object to test. criteria – An expression the stanza must match against. method – The type of matching to use; one of:
‘exact’, ‘mask’, ‘id’, ‘xpath’, and ‘stanzapath’. Defaults to the value of self.match_method.
- defaults – A list of stanza interfaces that have default
values. These interfaces will be set to their defaults for the given and generated stanzas to prevent unexpected test failures.
- use_values – Indicates if testing using stanza.values should
be used. Defaults to True.
- class slidge.util.test.SlidgeTest(*args, **kwargs)[source]#
Bases:
SlixTestPlus
A Slixmpp specific TestCase class that provides methods for comparing message, iq, and presence stanzas.
- Methods:
Message – Create a Message stanza object. Iq – Create an Iq stanza object. Presence – Create a Presence stanza object. check_jid – Check a JID and its component parts. check – Compare a stanza against an XML string. stream_start – Initialize a dummy XMPP client. stream_close – Disconnect the XMPP client. make_header – Create a stream header. send_header – Check that the given header has been sent. send_feature – Send a raw XML element. send – Check that the XMPP client sent the given
generic stanza.
- recv – Queue data for XMPP client to receive, or
verify the data that was received from a live connection.
- recv_header – Check that a given stream header
was received.
- recv_feature – Check that a given, raw XML element
was recveived.
fix_namespaces – Add top-level namespace to an XML object. compare – Compare XML objects against each other.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- plugin: types.ModuleType | dict[source]#