import unittest from slixmpp import Message from slixmpp.test import SlixTest from slixmpp.plugins.xep_0461 import stanza class TestReply(SlixTest): def setUp(self): stanza.register_plugins() def testReply(self): message = Message() message["reply"]["id"] = "some-id" message["body"] = "some-body" self.check( message, """ some-body """, ) def testFallback(self): message = Message() message["body"] = "12345\nrealbody" message["feature_fallback"]["for"] = "NS" message["feature_fallback"]["fallback_body"]["start"] = 0 message["feature_fallback"]["fallback_body"]["end"] = 6 self.check( message, """ 12345\nrealbody """, ) assert message["feature_fallback"].get_stripped_body() == "realbody" def testAddFallBackHelper(self): msg = Message() msg["body"] = "Great" msg["feature_fallback"].add_quoted_fallback("Anna wrote:\nHi, how are you?") # ugly dedent but the test does not pass without it self.check( msg, """ > Anna wrote:\n> Hi, how are you?\nGreat """ ) suite = unittest.TestLoader().loadTestsFromTestCase(TestReply)