summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobert Robinson <rerobins@gmail.com>2015-09-15 10:07:34 -0600
committerRobert Robinson <rerobins@gmail.com>2015-09-15 10:07:34 -0600
commit7059400020d21c960b87aa41189b1b26c3776061 (patch)
treea8b563451b58ba582564f5ef5c2b7f8c7e2735cd /tests
parent110cf25c6d6055e0decb6907bfc7d0df8434c839 (diff)
parent0b14ef82d4058925e7e9db22038777d4654e8199 (diff)
downloadslixmpp-7059400020d21c960b87aa41189b1b26c3776061.tar.gz
slixmpp-7059400020d21c960b87aa41189b1b26c3776061.tar.bz2
slixmpp-7059400020d21c960b87aa41189b1b26c3776061.tar.xz
slixmpp-7059400020d21c960b87aa41189b1b26c3776061.zip
Merge branch 'refactor_forms' into add_xep_0122
Diffstat (limited to 'tests')
-rw-r--r--tests/test_stanza_xep_0004.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/test_stanza_xep_0004.py b/tests/test_stanza_xep_0004.py
index e8bc6593..b87afb24 100644
--- a/tests/test_stanza_xep_0004.py
+++ b/tests/test_stanza_xep_0004.py
@@ -197,5 +197,52 @@ class TestDataForms(SleekTest):
<x xmlns="jabber:x:data" type="cancel" />
""")
+ def testReported(self):
+ msg = self.Message()
+ form = msg['form']
+ form['type'] = 'result'
+
+ form.add_reported(var='f1', ftype='text-single', label='Username')
+
+ form.add_item({'f1': 'username@example.org'})
+
+ self.check(msg, """
+ <message>
+ <x xmlns="jabber:x:data" type="result">
+ <reported>
+ <field var="f1" type="text-single" label="Username" />
+ </reported>
+ <item>
+ <field var="f1">
+ <value>username@example.org</value>
+ </field>
+ </item>
+ </x>
+ </message>
+ """)
+
+ def testSetReported(self):
+ msg = self.Message()
+ form = msg['form']
+ form['type'] = 'result'
+
+ reported = {'f1': {
+ 'var': 'f1',
+ 'type': 'text-single',
+ 'label': 'Username'
+ }}
+
+ form.set_reported(reported)
+
+ self.check(msg, """
+ <message>
+ <x xmlns="jabber:x:data" type="result">
+ <reported>
+ <field var="f1" type="text-single" label="Username" />
+ </reported>
+ </x>
+ </message>
+ """)
+
suite = unittest.TestLoader().loadTestsFromTestCase(TestDataForms)