Beispiel #1
0
def test_overwrite(tmp_docmanager_overwrite):
    """Checks if it's possible to overwrite the value of a property
       in an XML document

    :param py.path.local tmp_docmanager_overwrite: Fixture, pointing to a
                                                   temporary  XML file
    """

    handler = XmlHandler(tmp_docmanager_overwrite.strpath)
    handler.set({"hello": "world"})

    assert handler.get("hello") == { "hello": "world" }, \
        'Could not override old value of property "hello" in file test.override.xml'
def test_docmanager_init_1(tmp_valid_xml, option, value):
    """ Test the init sub command with pre defined values """

    tmpfile = tmp_valid_xml.strpath

    ropt = option.replace("/", "-")

    clicmd = "init --{} \"{}\" {}".format(ropt, value, tmpfile)
    a = Actions(parsecli(shlex.split(clicmd)))
    a.parse()

    handler = XmlHandler(tmpfile)

    ret = handler.get(option)
    assert ret[
        option] == value, "The file was initialized without the pre defined value for the option '{}'.".format(
            option)