Add test to verify mar signatures

This commit is contained in:
Chris AtLee 2015-02-03 15:48:40 -05:00
Родитель c451b2b78d
Коммит 5851bdf57a
3 изменённых файлов: 29 добавлений и 0 удалений

9
tests/test.pubkey Normal file
Просмотреть файл

@ -0,0 +1,9 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvH4r94FpQ0gvr1hhTfV9
NUeWPJ5CN6TZRq7v/Dc4nkJ1J4IP1B3UEii34tcNKpy1nKupiZuTT6T1zQYT+z5x
3UkDF9qQboQ8RNb/BEz/cN3on/LTEnZ7YSraRL11M6cEB8mvmJxddCEquwqccRbs
Usp8WUB7uRv1w6Anley7N9F/LE1iLPwJasZypRnzWb3aYsJy0cMFOYy+OXVdpktn
qYqlNIjnt84u4Nil6UXnBbIJNUVOCY8wOFClNvVpubjPkWK1gtdWy3x/hJU5RpAO
K9cnHxq4M/I4SUWTWO3r7yweQiHG4Jyoc7sP1jkwjBkSG93sDEycfwOdOoZft3wN
sQIDAQAB
-----END PUBLIC KEY-----

19
tests/test_signing.py Normal file
Просмотреть файл

@ -0,0 +1,19 @@
from unittest import TestCase
import os
from mardor.marfile import MarFile
TEST_MAR = os.path.join(os.path.dirname(__file__), 'test.mar')
# This was extracted via:
# curl
# https://hg.mozilla.org/mozilla-central/raw-file/58e4264903ba/toolkit/mozapps/update/updater/release_primary.der
# | openssl x509 -inform DER -pubkey -noout
TEST_KEY = os.path.join(os.path.dirname(__file__), 'test.pubkey')
class TestMarSignatures(TestCase):
def test_verify(self):
"""Check that our test mar is signed correctly"""
marfile = MarFile(TEST_MAR, signature_versions=[(1, TEST_KEY)])
marfile.verify_signatures()

Просмотреть файл

@ -8,6 +8,7 @@ setenv =
deps =
nose
coverage
cryptography
commands =
coverage run -a --branch --source=mardor {envbindir}/nosetests