def test_produce_root_enclosed(): model = RootFixture(local_name='RootFixture', namespace='http://jaymes.biz/test', prefix='test') model.EnclosedFixture = EnclosedFixture(local_name='EnclosedFixture') assert model.produce().produce() == \ '<test:RootFixture xmlns:test="http://jaymes.biz/test"><test:EnclosedFixture/></test:RootFixture>'
def test_references(): root = RootFixture() enc = EnclosedFixture() enc._parent = root enc.id = 'reftest1' assert root.find_reference('reftest1') == enc with pytest.raises(ReferenceException): root.find_reference('test1')
def test_references(): root = RootFixture() #TODO need to add to a attr mapper knows about enc = EnclosedFixture() enc.id = 'reftest1' root.EnclosedFixture = enc assert root.find_reference('reftest1') == enc with pytest.raises(ReferenceException): root.find_reference('test1')
def test_to_xml_root_enclosed(): el = RootFixture() el.EnclosedFixture = EnclosedFixture(tag_name='EnclosedFixture') assert ET.tostring(el.to_xml()) == \ b'<test:RootFixture xmlns:test="http://jaymes.biz/test"><test:EnclosedFixture /></test:RootFixture>'
def test_str_name(): root = RootFixture() root.name = 'test' assert str(root) == ('fixtures.test.RootFixture.RootFixture name: test')
def test_str_Id(): root = RootFixture() root.Id = 'test' assert str(root) == ('fixtures.test.RootFixture.RootFixture Id: test')
def test_str_id(): root = RootFixture() root.id = 'test' assert str(root) == ('fixtures.test.RootFixture.RootFixture id: test')
def test_get_package(): root = RootFixture() assert root.get_package() == 'fixtures.test'
def test_init_tag_name(): root = RootFixture(tag_name='test') assert root.to_xml().tag == '{http://jaymes.biz/test}test'
def test_get_el_attr_names(): model = RootFixture() assert model._get_element_mapper_attr_names() == [ 'EnclosedFixture', 'EnumValue', 'PatternValue' ]
def test_children_attr(): model = RootFixture() model.EnclosedFixture = EnclosedFixture() assert model._children == [('EnclosedFixture', None)]
def test_str_name(): root = RootFixture() root.name = 'test' assert str(root) == ('RootFixture name: test')
def test_str_Id(): root = RootFixture() root.Id = 'test' assert str(root) == ('RootFixture Id: test')
def test_str_id(): root = RootFixture() root.id = 'test' assert str(root) == ('RootFixture id: test')
def test_str_id_func(): root = RootFixture() assert str(root) == ('RootFixture # ' + str(id(root)))