diff options
author | Lance Stout <lancestout@gmail.com> | 2010-10-07 10:58:13 -0400 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2010-10-07 10:58:13 -0400 |
commit | 0fffbb82000a1a6c3c23d62fedcbd8e8141f8994 (patch) | |
tree | 114c3767ccc13de3d0388b43cd357b90334f469a /tests/test_forms.py | |
parent | 21c32c6e1cfd9b18e4c8320e0796e1d7e4b3f74c (diff) | |
download | slixmpp-0fffbb82000a1a6c3c23d62fedcbd8e8141f8994.tar.gz slixmpp-0fffbb82000a1a6c3c23d62fedcbd8e8141f8994.tar.bz2 slixmpp-0fffbb82000a1a6c3c23d62fedcbd8e8141f8994.tar.xz slixmpp-0fffbb82000a1a6c3c23d62fedcbd8e8141f8994.zip |
Unit test reorganization.
Moved SleekTest to sleekxmpp.test.
Organized test suites by their focus.
- Suites focused on testing stanza objects are named test_stanza_X.py
- Suites focused on testing stream behavior are name test_stream_X.py
Diffstat (limited to 'tests/test_forms.py')
-rw-r--r-- | tests/test_forms.py | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/tests/test_forms.py b/tests/test_forms.py deleted file mode 100644 index 67b0f6a8..00000000 --- a/tests/test_forms.py +++ /dev/null @@ -1,115 +0,0 @@ -from . sleektest import * -import sleekxmpp.plugins.xep_0004 as xep_0004 - - -class TestDataForms(SleekTest): - - def setUp(self): - registerStanzaPlugin(Message, xep_0004.Form) - registerStanzaPlugin(xep_0004.Form, xep_0004.FormField) - registerStanzaPlugin(xep_0004.FormField, xep_0004.FieldOption) - - def testMultipleInstructions(self): - """Testing using multiple instructions elements in a data form.""" - msg = self.Message() - msg['form']['instructions'] = "Instructions\nSecond batch" - - self.check_message(msg, """ - <message> - <x xmlns="jabber:x:data" type="form"> - <instructions>Instructions</instructions> - <instructions>Second batch</instructions> - </x> - </message> - """) - - def testAddField(self): - """Testing adding fields to a data form.""" - - msg = self.Message() - form = msg['form'] - form.addField(var='f1', - ftype='text-single', - label='Text', - desc='A text field', - required=True, - value='Some text!') - - self.check_message(msg, """ - <message> - <x xmlns="jabber:x:data" type="form"> - <field var="f1" type="text-single" label="Text"> - <desc>A text field</desc> - <required /> - <value>Some text!</value> - </field> - </x> - </message> - """) - - form['fields'] = [('f1', {'type': 'text-single', - 'label': 'Username', - 'required': True}), - ('f2', {'type': 'text-private', - 'label': 'Password', - 'required': True}), - ('f3', {'type': 'text-multi', - 'label': 'Message', - 'value': 'Enter message.\nA long one even.'}), - ('f4', {'type': 'list-single', - 'label': 'Message Type', - 'options': [{'label': 'Cool!', - 'value': 'cool'}, - {'label': 'Urgh!', - 'value': 'urgh'}]})] - self.check_message(msg, """ - <message> - <x xmlns="jabber:x:data" type="form"> - <field var="f1" type="text-single" label="Username"> - <required /> - </field> - <field var="f2" type="text-private" label="Password"> - <required /> - </field> - <field var="f3" type="text-multi" label="Message"> - <value>Enter message.</value> - <value>A long one even.</value> - </field> - <field var="f4" type="list-single" label="Message Type"> - <option label="Cool!"> - <value>cool</value> - </option> - <option label="Urgh!"> - <value>urgh</value> - </option> - </field> - </x> - </message> - """) - - def testSetValues(self): - """Testing setting form values""" - - msg = self.Message() - form = msg['form'] - form.setFields([ - ('foo', {'type': 'text-single'}), - ('bar', {'type': 'list-multi'})]) - - form.setValues({'foo': 'Foo!', - 'bar': ['a', 'b']}) - - self.check_message(msg, """ - <message> - <x xmlns="jabber:x:data" type="form"> - <field var="foo" type="text-single"> - <value>Foo!</value> - </field> - <field var="bar" type="list-multi"> - <value>a</value> - <value>b</value> - </field> - </x> - </message>""") - -suite = unittest.TestLoader().loadTestsFromTestCase(TestDataForms) |