def test_with_children(self): fields = {"hello": "there"} children_tags = ["bar", "baz"] children = [Element(child_tag) for child_tag in children_tags] request_data = make_request_data("foo", fields, children) root = XML(request_data) self.assertEqual("foo", root.tag) self.assertItemsEqual(children_tags, (e.tag for e in root))
def test_with_children(self): fields = {'hello': 'there'} children_tags = ['bar', 'baz'] children = [Element(child_tag) for child_tag in children_tags] request_data = make_request_data('foo', fields, children) root = XML(request_data) self.assertEqual('foo', root.tag) self.assertItemsEqual(children_tags, (e.tag for e in root))
def test_no_fields(self): request_data = make_request_data("foo") root = XML(request_data) self.assertEqual("foo", root.tag)
def test_no_children(self): fields = {"hello": "there"} request_data = make_request_data("foo", fields) root = XML(request_data) self.assertEqual("foo", root.tag) self.assertEqual("there", root.get("hello"))
def test_no_children(self): fields = {'hello': 'there'} request_data = make_request_data('foo', fields) root = XML(request_data) self.assertEqual('foo', root.tag) self.assertEqual('there', root.get('hello'))