summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-03-17 20:21:18 +0200
committerLars Wirzenius <liw@liw.fi>2016-03-17 20:57:42 +0200
commitf72a0c173155bc0c2c4d205062259d026b071260 (patch)
tree577170325946f59c1d90beb76d7927260f0f51fb
parent080e11b84d7f833e889c77dff1a47eda9d8bd637 (diff)
downloadobnam-f72a0c173155bc0c2c4d205062259d026b071260.tar.gz
Drop unused variables, FakeRepository class
-rw-r--r--obnamlib/whole_file_checksummer_tests.py21
1 files changed, 1 insertions, 20 deletions
diff --git a/obnamlib/whole_file_checksummer_tests.py b/obnamlib/whole_file_checksummer_tests.py
index f2aeba92..473831b9 100644
--- a/obnamlib/whole_file_checksummer_tests.py
+++ b/obnamlib/whole_file_checksummer_tests.py
@@ -25,15 +25,12 @@ import obnamlib
class WholeFileCheckSummerTests(unittest.TestCase):
def test_computes_nothing_if_repo_wants_no_checksum(self):
- repo = FakeRepository(None)
summer = obnamlib.WholeFileCheckSummer(None)
chunk = 'hello'
- token = repo.prepare_chunk_for_indexes(chunk)
- summer.append_chunk(chunk, token)
+ summer.append_chunk(chunk, None)
self.assertEqual(summer.get_checksum(), None)
def test_computes_checksum_for_md5(self):
- repo = FakeRepository(obnamlib.REPO_FILE_MD5)
summer = obnamlib.WholeFileCheckSummer(obnamlib.REPO_FILE_MD5)
chunk = 'hello'
chunk_id = None
@@ -43,27 +40,11 @@ class WholeFileCheckSummerTests(unittest.TestCase):
'5d41402abc4b2a76b9719d911017c592')
def test_computes_checksum_for_sha512(self):
- repo = FakeRepository(obnamlib.REPO_FILE_SHA512)
summer = obnamlib.WholeFileCheckSummer(obnamlib.REPO_FILE_SHA512)
chunk = 'hello'
- token = repo.prepare_chunk_for_indexes(chunk)
chunk_id = '123'
summer.append_chunk(chunk, chunk_id)
expected = hashlib.sha512('{},{};'.format(len(chunk), chunk_id))
self.assertEqual(summer.get_checksum(), expected.hexdigest())
-
-
-class FakeRepository(object):
-
- def __init__(self, file_key):
- self._file_key = file_key
-
- def get_client_checksum_key(self, client_name):
- return self._file_key
-
- def prepare_chunk_for_indexes(self, data):
- if self._file_key is None:
- return None
- return 'fake checksum'