summaryrefslogtreecommitdiff
path: root/subplot/client.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-01-04 18:03:04 +0000
committerLars Wirzenius <liw@liw.fi>2021-01-04 18:03:04 +0000
commit678e65c57ae983ef66d16e92965814b0f3f0d73f (patch)
tree260f2edd09047de5843a168ce59f284ac3445ce7 /subplot/client.py
parent6c00201a0aaf75071388981591d76bebdc7b1f03 (diff)
parent34a9fc7cf754552b02b194f7e1186adc9414a623 (diff)
downloadobnam2-678e65c57ae983ef66d16e92965814b0f3f0d73f.tar.gz
Merge branch 'checksum' into 'main'
Checksum See merge request larswirzenius/obnam!61
Diffstat (limited to 'subplot/client.py')
-rw-r--r--subplot/client.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/subplot/client.py b/subplot/client.py
index c1f5159..53c7f6e 100644
--- a/subplot/client.py
+++ b/subplot/client.py
@@ -50,6 +50,13 @@ def run_obnam_restore_with_genref(ctx, filename=None, genref=None, todir=None):
)
+def run_obnam_get_chunk(ctx, filename=None, gen_id=None, todir=None):
+ runcmd_run = globals()["runcmd_run"]
+ gen_id = ctx["vars"][gen_id]
+ logging.debug(f"run_obnam_get_chunk: gen_id={gen_id}")
+ runcmd_run(ctx, ["obnam", "--config", filename, "get-chunk", gen_id])
+
+
def capture_generation_id(ctx, varname=None):
runcmd_get_stdout = globals()["runcmd_get_stdout"]
@@ -95,3 +102,11 @@ def get_backup_reason(ctx, filename):
lines = [line for line in lines if filename in line]
line = lines[0]
return line.split()[-1]
+
+
+def stdout_matches_file(ctx, filename=None):
+ runcmd_get_stdout = globals()["runcmd_get_stdout"]
+ assert_eq = globals()["assert_eq"]
+ stdout = runcmd_get_stdout(ctx)
+ data = open(filename).read()
+ assert_eq(stdout, data)