summaryrefslogtreecommitdiff
path: root/subplot/data.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-06-04 06:35:14 +0000
committerLars Wirzenius <liw@liw.fi>2021-06-04 06:35:14 +0000
commitf2a274ee1291531c1154176bca5b9a47e9c234bd (patch)
tree6721b515739c6e5f9236ffd6f4ecc2dfecc471d2 /subplot/data.py
parentcb33088dbedf4b772013f83b8226047cc4355dd2 (diff)
parent9c2590d2428f0d3de882686ec2ec5832e7123c62 (diff)
downloadobnam2-f2a274ee1291531c1154176bca5b9a47e9c234bd.tar.gz
Merge branch 'aead' into 'main'
add encryption of individual chunks Closes #110 See merge request larswirzenius/obnam!146
Diffstat (limited to 'subplot/data.py')
-rw-r--r--subplot/data.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/subplot/data.py b/subplot/data.py
index d134e5f..13b6d2b 100644
--- a/subplot/data.py
+++ b/subplot/data.py
@@ -170,3 +170,19 @@ def file_is_readable_by_owner(ctx, filename=None):
def file_does_not_contain(ctx, filename=None, pattern=None):
data = open(filename).read()
assert pattern not in data
+
+
+def files_are_different(ctx, filename1=None, filename2=None):
+ assert_ne = globals()["assert_ne"]
+
+ data1 = open(filename1, "rb").read()
+ data2 = open(filename2, "rb").read()
+ assert_ne(data1, data2)
+
+
+def files_are_identical(ctx, filename1=None, filename2=None):
+ assert_eq = globals()["assert_eq"]
+
+ data1 = open(filename1, "rb").read()
+ data2 = open(filename2, "rb").read()
+ assert_eq(data1, data2)