Example #1
0
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>'
Example #2
0
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')
Example #3
0
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')
Example #4
0
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>'
Example #5
0
def test_str_name():
    root = RootFixture()
    root.name = 'test'
    assert str(root) == ('fixtures.test.RootFixture.RootFixture name: test')
Example #6
0
def test_str_Id():
    root = RootFixture()
    root.Id = 'test'
    assert str(root) == ('fixtures.test.RootFixture.RootFixture Id: test')
Example #7
0
def test_str_id():
    root = RootFixture()
    root.id = 'test'
    assert str(root) == ('fixtures.test.RootFixture.RootFixture id: test')
Example #8
0
def test_get_package():
    root = RootFixture()
    assert root.get_package() == 'fixtures.test'
Example #9
0
def test_init_tag_name():
    root = RootFixture(tag_name='test')
    assert root.to_xml().tag == '{http://jaymes.biz/test}test'
Example #10
0
def test_get_el_attr_names():
    model = RootFixture()
    assert model._get_element_mapper_attr_names() == [
        'EnclosedFixture', 'EnumValue', 'PatternValue'
    ]
Example #11
0
def test_children_attr():
    model = RootFixture()
    model.EnclosedFixture = EnclosedFixture()
    assert model._children == [('EnclosedFixture', None)]
Example #12
0
def test_str_name():
    root = RootFixture()
    root.name = 'test'
    assert str(root) == ('RootFixture name: test')
Example #13
0
def test_str_Id():
    root = RootFixture()
    root.Id = 'test'
    assert str(root) == ('RootFixture Id: test')
Example #14
0
def test_str_id():
    root = RootFixture()
    root.id = 'test'
    assert str(root) == ('RootFixture id: test')
Example #15
0
def test_str_id_func():
    root = RootFixture()
    assert str(root) == ('RootFixture # ' + str(id(root)))
Example #16
0
def test_get_package():
    root = RootFixture()
    assert root.get_package() == 'fixtures.test'