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 testStr(self): f = Form() f.addField(FormField('name')) f.addField(FormField('name2')) f2 = Form() f2.addField(FormField('a')) f2.addField(FormField('b')) f2.addField(FormField('c')) mce = MissingConfigError('test', [f, f2]) s = str(mce) self.assertTrue(str(f.asDict()) in s) self.assertTrue(str(f2.asDict()) in s) self.assertTrue('`--debug`' in s) self.assertTrue("'test'" in s) self.assertTrue("'hardcoded-ui'" in s)
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)])