Example #1
0
def test_temp_passes_attributes(run, attributes):
    run.expects_call().returns(run_result("path"))
    (attributes.expects_call().with_args("path",
                                         mode="foo",
                                         owner="bar",
                                         group="baz"))
    file.temp("foo", "bar", "baz")
Example #2
0
def test_temp_default_attributes(run, attributes):
    run.expects_call().returns(run_result("path"))
    (attributes.expects_call().with_args("path",
                                         mode=None,
                                         owner=None,
                                         group=None))
    file.temp()
Example #3
0
def _create_network(name, subnet):
    tempfile = file.temp()
    try:
        definition = _NETWORK_TEMPLATE % dict(name=name, subnet=subnet)
        file.write(tempfile, definition)
        core.run("virsh net-define %s" % tempfile)
        core.run("virsh net-autostart %s" % name)
    finally:
        file.remove(tempfile)
Example #4
0
def test_temp_calles_mktemp(run, attributes):
    (run.expects_call().with_args("mktemp").returns(run_result("foo")))
    attributes.expects_call()
    assert file.temp() == "foo"
Example #5
0
def test_temp_passes_attributes(run, attributes):
    run.expects_call().returns(run_result("path"))
    (attributes.expects_call().with_args("path", mode="foo", owner="bar", group="baz"))
    file.temp("foo", "bar", "baz")
Example #6
0
def test_temp_default_attributes(run, attributes):
    run.expects_call().returns(run_result("path"))
    (attributes.expects_call().with_args("path", mode=None, owner=None, group=None))
    file.temp()
Example #7
0
def test_temp_calles_mktemp(run, attributes):
    (run.expects_call().with_args("mktemp").returns(run_result("foo")))
    attributes.expects_call()
    assert file.temp() == "foo"