def test_no_submit(self): formNoSubmit = Form(self.page, self.el, False) self.assertDictEqual( formNoSubmit, collections.OrderedDict([('nom', 'Dupont'), ('prenom', ''), ('mySelect', 'item2'), ('mySelectNotSelected', 'item1')]))
def test_init_nominal_case(self): form = Form(self.page, self.el, None) self.assertDictEqual( form, collections.OrderedDict([('nom', 'Dupont'), ('prenom', ''), ('mySelect', 'item2'), ('mySelectNotSelected', 'item1'), ('submitForm', u'')]))
def test_warning_more_submit(self): with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') Form(self.page, self.elMoreSubmit) warningMsg = "Form has more than one submit input, you" + \ " should chose the correct one" assert len(w) == 1 assert issubclass(w[-1].category, FormSubmitWarning) assert warningMsg in str(w[-1].message)
def test_warning_submit_not_find(self): with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') Form( self.page, self.el, lxml.html.fromstring( "<input type='submit' name='submitNotFind' />")) warningMsg = "Form had a submit element provided, but" + \ " it was not found" assert len(w) == 1 assert issubclass(w[-1].category, FormSubmitWarning) assert warningMsg in str(w[-1].message)