aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2017-05-26 00:13:59 -0700
committerbnewbold <bnewbold@robocracy.org>2017-05-26 00:19:40 -0700
commite41e8ab92d038a99c97439e489071211da3329cb (patch)
tree543809ef23d75ffc4062c63230cebbe39a13bb23 /tests
parent4b0a50b25f72a5b2d693379f9693b37131c12371 (diff)
downloadbad-hashish-e41e8ab92d038a99c97439e489071211da3329cb.tar.gz
bad-hashish-e41e8ab92d038a99c97439e489071211da3329cb.zip
add some very basic test files
Diffstat (limited to 'tests')
-rw-r--r--tests/correct.sha13
-rwxr-xr-xtests/tarsum.py25
-rw-r--r--tests/test.tar.gzbin0 -> 1485 bytes
-rw-r--r--tests/test.zipbin0 -> 1900 bytes
4 files changed, 28 insertions, 0 deletions
diff --git a/tests/correct.sha1 b/tests/correct.sha1
new file mode 100644
index 0000000..f272748
--- /dev/null
+++ b/tests/correct.sha1
@@ -0,0 +1,3 @@
+36e01a203d190da18a25071b8d9f6e1312df8a78 junk_files/blank.jpg
+aac0af8f10f31fa4d863eb984fbb1f50a21ac753 junk_files/lorem.txt
+bc9d478235544fe6436d461461118eb47d9ae098 junk_files/small.txt
diff --git a/tests/tarsum.py b/tests/tarsum.py
new file mode 100755
index 0000000..23d397d
--- /dev/null
+++ b/tests/tarsum.py
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+"""
+From: https://gist.github.com/DaveCTurner/8765561
+
+Modified to print with an extra space between fields
+"""
+
+import sys
+import tarfile
+import hashlib
+
+for filename in sys.argv[1:]:
+ print filename
+ with tarfile.open(filename, 'r') as tar:
+ for tarinfo in tar:
+ if tarinfo.isreg():
+ flo = tar.extractfile(tarinfo) # NB doesn't really extract the file, just gives you a stream (file-like-object) for reading it
+ hash = hashlib.sha1()
+ while True:
+ data = flo.read(2**20)
+ if not data:
+ break
+ hash.update(data)
+ flo.close()
+ print hash.hexdigest(), '', tarinfo.name
diff --git a/tests/test.tar.gz b/tests/test.tar.gz
new file mode 100644
index 0000000..6b547f4
--- /dev/null
+++ b/tests/test.tar.gz
Binary files differ
diff --git a/tests/test.zip b/tests/test.zip
new file mode 100644
index 0000000..d7e828d
--- /dev/null
+++ b/tests/test.zip
Binary files differ