def testasXML(self): f = Form() f.addField(FormField('name')) f.addField(FormField('name2')) tpl = f.asXML() self.assertEqual(len(tpl), 2) self.assertIn(('param', {'name': 'name'}, [], None), tpl) self.assertIn(('param', {'name': 'name2'}, [], None), tpl)
def testasXML2Submit(self): f = Form() f.addField(FormField('name', 'submit')) f.addField(FormField('name2', 'submit')) f.takeValuesFromAnswer({'name2': None}) self.assertEqual(f.asXML(), [('param', {'name': 'name2'}, [], None)])