diff options
author | Link Mauve <linkmauve@linkmauve.fr> | 2020-12-04 20:03:32 +0100 |
---|---|---|
committer | Link Mauve <linkmauve@linkmauve.fr> | 2020-12-04 20:03:32 +0100 |
commit | 05749c49690c00f2b1794212b2fb9281b6956a89 (patch) | |
tree | 06600402c84040badb8c51a84f683a2ca467ca13 /tests/test_stanza_xep_0439.py | |
parent | e592a46c99888594bfb0bf71da99c88755912a37 (diff) | |
parent | c2b09c5c8317d919d7df94b85ac92910de05904a (diff) | |
download | slixmpp-05749c49690c00f2b1794212b2fb9281b6956a89.tar.gz slixmpp-05749c49690c00f2b1794212b2fb9281b6956a89.tar.bz2 slixmpp-05749c49690c00f2b1794212b2fb9281b6956a89.tar.xz slixmpp-05749c49690c00f2b1794212b2fb9281b6956a89.zip |
Merge branch 'more-xeps' into 'master'
Add a batch of newer XEPs
See merge request poezio/slixmpp!69
Diffstat (limited to 'tests/test_stanza_xep_0439.py')
-rw-r--r-- | tests/test_stanza_xep_0439.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/test_stanza_xep_0439.py b/tests/test_stanza_xep_0439.py new file mode 100644 index 00000000..fbd3aa47 --- /dev/null +++ b/tests/test_stanza_xep_0439.py @@ -0,0 +1,57 @@ +import unittest +from slixmpp import Message +from slixmpp.test import SlixTest +from slixmpp.plugins.xep_0439 import stanza + + +class TestQuickResponse(SlixTest): + + def setUp(self): + stanza.register_plugins() + + def testResponse(self): + message = Message() + message['body'] = 'Reply 1 or 2?' + for (value, label) in [('1', 'Rep 1'), ('2', 'Rep 2')]: + rep = stanza.Response() + rep['value'] = value + rep['label'] = label + message.append(rep) + + self.check(message, """ +<message> + <body>Reply 1 or 2?</body> + <response xmlns="urn:xmpp:tmp:quick-response" value="1" label="Rep 1" /> + <response xmlns="urn:xmpp:tmp:quick-response" value="2" label="Rep 2" /> +</message> + """, use_values=False) + + def testAction(self): + message = Message() + message['body'] = 'action 1 or 2?' + for (id_, label) in [('1', 'action 1'), ('2', 'action 2')]: + act = stanza.Action() + act['id'] = id_ + act['label'] = label + message.append(act) + + self.check(message, """ +<message> + <body>action 1 or 2?</body> + <action xmlns="urn:xmpp:tmp:quick-response" id="1" label="action 1" /> + <action xmlns="urn:xmpp:tmp:quick-response" id="2" label="action 2" /> +</message> + """, use_values=False) + + def testActionSelected(self): + message = Message() + message['action_selected']['id'] = 'act1' + + self.check(message, """ +<message> + <action-selected xmlns="urn:xmpp:tmp:quick-response" id="act1" /> +</message> + """, use_values=False) + + +suite = unittest.TestLoader().loadTestsFromTestCase(TestQuickResponse) |