mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-26 01:37:20 +00:00
move return codes tests to own module
This commit is contained in:
parent
245bdef4eb
commit
3c247b8109
2 changed files with 20 additions and 18 deletions
|
@ -134,24 +134,6 @@ def exec_fn(*args, **kw):
|
|||
return exec_fn
|
||||
|
||||
|
||||
def test_return_codes(cmd, tmpdir):
|
||||
repo = tmpdir.mkdir("repo")
|
||||
input = tmpdir.mkdir("input")
|
||||
output = tmpdir.mkdir("output")
|
||||
input.join("test_file").write("content")
|
||||
rc, out = cmd("--repo=%s" % str(repo), "rcreate", "--encryption=none")
|
||||
assert rc == EXIT_SUCCESS
|
||||
rc, out = cmd("--repo=%s" % repo, "create", "archive", str(input))
|
||||
assert rc == EXIT_SUCCESS
|
||||
with changedir(str(output)):
|
||||
rc, out = cmd("--repo=%s" % repo, "extract", "archive")
|
||||
assert rc == EXIT_SUCCESS
|
||||
rc, out = cmd("--repo=%s" % repo, "extract", "archive", "does/not/match")
|
||||
assert rc == EXIT_WARNING # pattern did not match
|
||||
rc, out = cmd("--repo=%s" % repo, "create", "archive", str(input))
|
||||
assert rc == EXIT_ERROR # duplicate archive name
|
||||
|
||||
|
||||
"""
|
||||
test_disk_full is very slow and not recommended to be included in daily testing.
|
||||
for this test, an empty, writable 16MB filesystem mounted on DF_MOUNT is required.
|
||||
|
|
20
src/borg/testsuite/archiver/return_codes.py
Normal file
20
src/borg/testsuite/archiver/return_codes.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
from ...constants import * # NOQA
|
||||
from . import cmd, changedir
|
||||
|
||||
|
||||
def test_return_codes(cmd, tmpdir):
|
||||
repo = tmpdir.mkdir("repo")
|
||||
input = tmpdir.mkdir("input")
|
||||
output = tmpdir.mkdir("output")
|
||||
input.join("test_file").write("content")
|
||||
rc, out = cmd("--repo=%s" % str(repo), "rcreate", "--encryption=none")
|
||||
assert rc == EXIT_SUCCESS
|
||||
rc, out = cmd("--repo=%s" % repo, "create", "archive", str(input))
|
||||
assert rc == EXIT_SUCCESS
|
||||
with changedir(str(output)):
|
||||
rc, out = cmd("--repo=%s" % repo, "extract", "archive")
|
||||
assert rc == EXIT_SUCCESS
|
||||
rc, out = cmd("--repo=%s" % repo, "extract", "archive", "does/not/match")
|
||||
assert rc == EXIT_WARNING # pattern did not match
|
||||
rc, out = cmd("--repo=%s" % repo, "create", "archive", str(input))
|
||||
assert rc == EXIT_ERROR # duplicate archive name
|
Loading…
Reference in a new issue