Commit 0115feaa authored by mathieui's avatar mathieui

tests: Add a MAM metadata stanza test

parent 3613cd5f
......@@ -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):
""", 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' />
suite = unittest.TestLoader().loadTestsFromTestCase(TestMAM)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment