mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 22:42:29 +03:00
convert test_signatures.py to black code format
This commit is contained in:
parent
8f351d8406
commit
d024c8964f
2 changed files with 23 additions and 11 deletions
|
@ -49,7 +49,6 @@ force-exclude = '''(
|
||||||
| tests/openssl-version-check-test\.py
|
| tests/openssl-version-check-test\.py
|
||||||
| tests/valid-package-names/test\.py
|
| tests/valid-package-names/test\.py
|
||||||
| tests/test_common\.py
|
| tests/test_common\.py
|
||||||
| tests/test_signatures\.py
|
|
||||||
| tests/test_update\.py
|
| tests/test_update\.py
|
||||||
)$'''
|
)$'''
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ class SignaturesTest(unittest.TestCase):
|
||||||
|
|
||||||
@unittest.skipIf(sys.byteorder == 'big', "androguard is not ported to big-endian")
|
@unittest.skipIf(sys.byteorder == 'big', "androguard is not ported to big-endian")
|
||||||
def test_main(self):
|
def test_main(self):
|
||||||
|
|
||||||
class OptionsFixture:
|
class OptionsFixture:
|
||||||
APK = [os.path.join(basedir, 'repo', 'com.politedroid_3.apk')]
|
APK = [os.path.join(basedir, 'repo', 'com.politedroid_3.apk')]
|
||||||
|
|
||||||
|
@ -30,17 +29,31 @@ class SignaturesTest(unittest.TestCase):
|
||||||
signatures.extract(OptionsFixture)
|
signatures.extract(OptionsFixture)
|
||||||
|
|
||||||
# check if extracted signatures are where they are supposed to be
|
# check if extracted signatures are where they are supposed to be
|
||||||
# also verify weather if extracted file contian what they should
|
# also verify weather if extracted file contain what they should
|
||||||
filesAndHashes = (
|
filesAndHashes = (
|
||||||
(os.path.join('metadata', 'com.politedroid', 'signatures', '3', 'MANIFEST.MF'),
|
(
|
||||||
'7dcd83f0c41a75457fd2311bf3c4578f80d684362d74ba8dc52838d353f31cf2'),
|
os.path.join(
|
||||||
(os.path.join('metadata', 'com.politedroid', 'signatures', '3', 'RELEASE.RSA'),
|
'metadata', 'com.politedroid', 'signatures', '3', 'MANIFEST.MF'
|
||||||
'883ef3d5a6e0bf69d2a58d9e255a7930f08a49abc38e216ed054943c99c8fdb4'),
|
),
|
||||||
(os.path.join('metadata', 'com.politedroid', 'signatures', '3', 'RELEASE.SF'),
|
'7dcd83f0c41a75457fd2311bf3c4578f80d684362d74ba8dc52838d353f31cf2',
|
||||||
'99fbb3211ef5d7c1253f3a7ad4836eadc9905103ce6a75916c40de2831958284'),
|
),
|
||||||
|
(
|
||||||
|
os.path.join(
|
||||||
|
'metadata', 'com.politedroid', 'signatures', '3', 'RELEASE.RSA'
|
||||||
|
),
|
||||||
|
'883ef3d5a6e0bf69d2a58d9e255a7930f08a49abc38e216ed054943c99c8fdb4',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
os.path.join(
|
||||||
|
'metadata', 'com.politedroid', 'signatures', '3', 'RELEASE.SF'
|
||||||
|
),
|
||||||
|
'99fbb3211ef5d7c1253f3a7ad4836eadc9905103ce6a75916c40de2831958284',
|
||||||
|
),
|
||||||
)
|
)
|
||||||
for path, checksum in filesAndHashes:
|
for path, checksum in filesAndHashes:
|
||||||
self.assertTrue(os.path.isfile(path),
|
self.assertTrue(
|
||||||
f'check whether {path!r} was extracted correctly.')
|
os.path.isfile(path),
|
||||||
|
f'check whether {path!r} was extracted correctly.',
|
||||||
|
)
|
||||||
with open(path, 'rb') as f:
|
with open(path, 'rb') as f:
|
||||||
self.assertEqual(hashlib.sha256(f.read()).hexdigest(), checksum)
|
self.assertEqual(hashlib.sha256(f.read()).hexdigest(), checksum)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue