Exemplo n.º 1
0
    def testDivFormElements(self):

        cases = {
            "testTextField": ["name"],
            "testPasswordField": ["password"],
            "testEmailField": ["email"],
            "testTextArea": ["description"],
            "testCheckboxOn": [{"name": "opt_in", "checked": True, "note": "Check here to opt in"}],
            "testCheckboxOff": [{"name": "opt_in", "note": "Check here to opt in"}],
            "testSelectByString": ["user_type(male, female)"],
            "testSelectByArray": [{"name": "user_type", "options": ["male", "female"]}],
        }

        for _case in cases:

            print _case

            case = cases[_case]
            html = self.getHTML(_case)

            form = FX()
            form.setFields(*case)

            self.maxDiff = None
            self.assertMultiLineEqual(form.getForm(), html)
Exemplo n.º 2
0
    def testFormTag(self):

        cases = {
            "testAction": {"action": "submit.php"},
            "testLegend": {"legend": "Create a user"},
            "testCustomButton": {"submit": "Create User"},
        }

        for _case in cases:

            print _case

            case = cases[_case]
            html = self.getHTML(_case)

            form = FX(**case)

            self.maxDiff = None
            self.assertMultiLineEqual(form.getForm(), html)