summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-03-09 19:44:21 +0100
committermathieui <mathieui@mathieui.net>2021-03-09 19:52:53 +0100
commit0115feaa31ef998b59da98c99c523ad34ed92651 (patch)
treea8d69783fe0c45f92e12c91cbd6dc69d6362514c /tests
parent3613cd5f1414c669769b997e3eadcfac8c9f687d (diff)
downloadslixmpp-0115feaa31ef998b59da98c99c523ad34ed92651.tar.gz
slixmpp-0115feaa31ef998b59da98c99c523ad34ed92651.tar.bz2
slixmpp-0115feaa31ef998b59da98c99c523ad34ed92651.tar.xz
slixmpp-0115feaa31ef998b59da98c99c523ad34ed92651.zip
tests: Add a MAM metadata stanza test
Diffstat (limited to 'tests')
-rw-r--r--tests/test_stanza_xep_0313.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_stanza_xep_0313.py b/tests/test_stanza_xep_0313.py
index d7bd3080..ac5fcb14 100644
--- a/tests/test_stanza_xep_0313.py
+++ b/tests/test_stanza_xep_0313.py
@@ -22,6 +22,10 @@ class TestMAM(SlixTest):
register_stanza_plugin(stanza.MAM, rstanza.Set)
register_stanza_plugin(stanza.Fin, rstanza.Set)
+ register_stanza_plugin(Iq, stanza.Metadata)
+ register_stanza_plugin(stanza.Metadata, stanza.Start)
+ register_stanza_plugin(stanza.Metadata, stanza.End)
+
def testMAMQuery(self):
"""Test that we can build a simple MAM query."""
iq = Iq()
@@ -77,5 +81,25 @@ class TestMAM(SlixTest):
</iq>
""", use_values=False)
+ def testMAMMetadata(self):
+ """Test that we can build a MAM metadata payload"""
+
+ iq = Iq()
+ iq['type'] = 'result'
+ iq['mam_metadata']['start']['id'] = 'YWxwaGEg'
+ iq['mam_metadata']['start']['timestamp'] = '2008-08-22T21:09:04Z'
+ iq['mam_metadata']['end']['id'] = 'b21lZ2Eg'
+ iq['mam_metadata']['end']['timestamp'] = '2020-04-20T14:34:21Z'
+
+ self.check(iq, """
+ <iq type='result'>
+ <metadata xmlns='urn:xmpp:mam:2'>
+ <start id='YWxwaGEg' timestamp='2008-08-22T21:09:04Z' />
+ <end id='b21lZ2Eg' timestamp='2020-04-20T14:34:21Z' />
+ </metadata>
+ </iq>
+ """)
+
+
suite = unittest.TestLoader().loadTestsFromTestCase(TestMAM)