From 0115feaa31ef998b59da98c99c523ad34ed92651 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 9 Mar 2021 19:44:21 +0100 Subject: [PATCH] tests: Add a MAM metadata stanza test --- tests/test_stanza_xep_0313.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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): """, 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, """ + + + + + + + """) + + suite = unittest.TestLoader().loadTestsFromTestCase(TestMAM)