Esempio n. 1
0
    def test_make_basic(self):
        limit = self._prepare_limit()
        tools.make_limit_node(self.root, limit)

        self._match_xml('<limit class="FakeLimit">'
                        '<attr name="required">required</attr>'
                        '</limit>')
Esempio n. 2
0
    def test_make_str_attr(self):
        limit = self._prepare_limit(str_attr="nospam")
        tools.make_limit_node(self.root, limit)

        self._match_xml('<limit class="FakeLimit">'
                        '<attr name="required">required</attr>'
                        '<attr name="str_attr">nospam</attr>'
                        '</limit>')
Esempio n. 3
0
    def test_make_float_attr(self):
        limit = self._prepare_limit(float_attr=3.14)
        tools.make_limit_node(self.root, limit)

        self._match_xml('<limit class="FakeLimit">'
                        '<attr name="float_attr">3.14</attr>'
                        '<attr name="required">required</attr>'
                        '</limit>')
Esempio n. 4
0
    def test_make_dict_attr(self):
        limit = self._prepare_limit(dict_attr=dict(foo='spam', bar='ni'))
        tools.make_limit_node(self.root, limit)

        self._match_xml('<limit class="FakeLimit">'
                        '<attr name="dict_attr">'
                        '<value key="bar">ni</value>'
                        '<value key="foo">spam</value>'
                        '</attr>'
                        '<attr name="required">required</attr>'
                        '</limit>')
Esempio n. 5
0
    def test_make_list_attr(self):
        limit = self._prepare_limit(list_attr=['spam', 'ni'])
        tools.make_limit_node(self.root, limit)

        self._match_xml('<limit class="FakeLimit">'
                        '<attr name="list_attr">'
                        '<value>spam</value>'
                        '<value>ni</value>'
                        '</attr>'
                        '<attr name="required">required</attr>'
                        '</limit>')