コード例 #1
0
ファイル: test_forms.py プロジェクト: nive/nive
    def test_values3(self, **kw):
        form = Form(loadFromType="type1", app=self.app, view=self.view)
        subsets = {u"test": {"fields": [u"ftext", FieldConf(id="section1", name="Section 1", datatype="string", schema=schema.String())]}}
        form.subsets = subsets
        form.Setup(subset=u"test")
        v,d,e = form.Validate(data1_2)
        self.assert_(v, e)

        result, data = form.Extract(data1_1)
        self.assert_(data)
        result, data = form.Extract(data1_2)
        self.assert_(data)
コード例 #2
0
    def test_empty(self, **kw):
        form = Form(loadFromType="type1", app=self.app, view=self.view)
        form.Setup()
        result, data = form.Extract({"ftext": ""})
        self.assert_(data.get("ftext") == "")

        form = Form(loadFromType="type2", app=self.app, view=self.view)
        form.Setup()
        result, data = form.Extract({"fstr": ""})
        self.assert_(data.get("fstr") == "" and data.get("ftext") == None)
コード例 #3
0
ファイル: test_forms.py プロジェクト: nive/nive
    def test_values2(self, **kw):
        form = Form(loadFromType="type1", app=self.app, view=self.view)
        subsets = {"test": {"fields": ["ftext",u"funit"]}}
        form.subsets = subsets
        form.Setup(subset="test")
        v,d,e = form.Validate(data1_2)
        self.assert_(v, e)

        form = Form(loadFromType="type1", app=self.app, view=self.view)
        subsets = {u"test": {"fields": [u"ftext", FieldConf(**{"id": "section1", "name": "Section 1", "datatype": "unit"})]}}
        form.subsets = subsets
        form.Setup(subset=u"test")
        v,d,e = form.Validate(data1_2)
        self.assert_(v, e)

        result, data = form.Extract(data1_1)
        self.assert_(data)
        result, data = form.Extract(data1_2)
        self.assert_(data)
コード例 #4
0
    def test_values(self, **kw):
        form = Form(loadFromType="type1", app=self.app, view=self.view)
        form.Setup()

        v, d, e = form.Validate(data=data1_1)
        self.assert_(v, str(e))

        v, d, e = form.Validate(data1_2)
        self.assertFalse(v, e)

        result, data = form.Extract(data1_1)
        self.assert_(data)
        result, data = form.Extract(data1_2)
        self.assert_(data)
コード例 #5
0
    def test_values3(self, **kw):
        form = Form(loadFromType="type1", app=self.app, view=self.view)
        subsets = {
            u"test": {
                "fields": [
                    u"ftext",
                    FieldConf(id="section1",
                              name="Section 1",
                              datatype="string",
                              schema=schema.String())
                ]
            }
        }
        form.subsets = subsets
        form.Setup(subset=u"test")
        v, d, e = form.Validate(data1_2)
        self.assert_(v, e)

        result, data = form.Extract(data1_1)
        self.assert_(data)
        result, data = form.Extract(data1_2)
        self.assert_(data)
コード例 #6
0
    def test_values2(self, **kw):
        form = Form(loadFromType="type1", app=self.app, view=self.view)
        subsets = {"test": {"fields": ["ftext", u"funit"]}}
        form.subsets = subsets
        form.Setup(subset="test")
        v, d, e = form.Validate(data1_2)
        self.assert_(v, e)

        form = Form(loadFromType="type1", app=self.app, view=self.view)
        subsets = {
            u"test": {
                "fields": [
                    u"ftext",
                    FieldConf(**{
                        "id": "section1",
                        "name": "Section 1",
                        "datatype": "unit"
                    })
                ]
            }
        }
        form.subsets = subsets
        form.Setup(subset=u"test")
        v, d, e = form.Validate(data1_2)
        self.assert_(v, e)

        result, data = form.Extract(data1_1)
        self.assert_(data)
        result, data = form.Extract(data1_2)
        self.assert_(data)