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")
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()
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)
def test_temp_calles_mktemp(run, attributes): (run.expects_call().with_args("mktemp").returns(run_result("foo"))) attributes.expects_call() assert file.temp() == "foo"