Skip to content

Commit

Permalink
Remove test checking for a list of checksums for single file
Browse files Browse the repository at this point in the history
Some time ago it was supported to have a list of checksums for a single
file which all must match. This is no longer the case as the checking
code expects a tuple.
Fix this and add tests for specifying `None` and tuples as values in the dict.
  • Loading branch information
Flamefire committed Jan 6, 2023
1 parent 8cec17f commit 9978251
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions test/framework/type_checking.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,6 @@ def test_check_type_of_param_value_checksums(self):
[('md5', md5_checksum), ('sha256', sha256_checksum1)],
# checksum as dict (file to checksum mapping)
[{'foo.txt': sha256_checksum1, 'bar.txt': sha256_checksum2}],
# list of checksums for a single file
[[md5_checksum]],
[[sha256_checksum1, sha256_checksum2, sha256_checksum3]],
# in the mix (3 files, each a different kind of checksum spec)...
[
sha256_checksum1,
Expand All @@ -211,20 +208,30 @@ def test_check_type_of_param_value_checksums(self):
],
# each item can be a list of checksums for a single file, which can be of different types...
[
# two checksums for a single file, *both* should match
[sha256_checksum1, md5_checksum],
# three checksums for a single file, *all* should match
[sha256_checksum1, ('md5', md5_checksum), {'foo.txt': sha256_checksum1}],
# two alternative checksums for a single file
(sha256_checksum1, md5_checksum),
# three alternative checksums for a single file
(sha256_checksum1, ('md5', md5_checksum), {'foo.txt': sha256_checksum1}),
# single checksum for a single file
sha256_checksum1,
# filename-to-checksum mapping
{'foo.txt': sha256_checksum1, 'bar.txt': sha256_checksum2},
# 3 alternative checksums for a single file, one match is sufficient
# 3 alternative checksums for a single file
(sha256_checksum1, sha256_checksum2, sha256_checksum3),
]
],
[
# Normal checksum
sha256_checksum1,
# None is allowed to skip checksum checking
None,
# Also in mappings
{'foo.txt': sha256_checksum1, 'bar.txt': None},
# alternative checksums are also allowed
{'foo.txt': (sha256_checksum2, sha256_checksum3), 'bar.txt': (sha256_checksum1, md5_checksum)},
],
]
for inp in inputs:
self.assertEqual(check_type_of_param_value('checksums', inp), (True, inp))
self.assertTrue(check_type_of_param_value('checksums', inp), 'Failed for ' + str(inp))

def test_check_type_of_param_value_patches(self):
"""Test check_type_of_param_value function for patches."""
Expand Down

0 comments on commit 9978251

Please sign in to comment.