From f72a0c173155bc0c2c4d205062259d026b071260 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 17 Mar 2016 20:21:18 +0200 Subject: Drop unused variables, FakeRepository class --- obnamlib/whole_file_checksummer_tests.py | 21 +-------------------- 1 file changed, 1 insertion(+), 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' -- cgit v1.2.1