Esempio n. 1
0
 def test_no_sign_missing_file(self):
     os.unlink(self.file_.file_path)
     assert not self.file_.is_signed
     assert not self.file_.cert_serial_num
     assert not self.file_.hash
     signing.sign_file(self.file_)
     assert not self.file_.is_signed
     assert not self.file_.cert_serial_num
     assert not self.file_.hash
     assert not signing.is_signed(self.file_.file_path)
Esempio n. 2
0
 def test_no_sign_missing_file(self):
     os.unlink(self.file_.file_path)
     assert not self.file_.is_signed
     assert not self.file_.cert_serial_num
     assert not self.file_.hash
     with self.assertRaises(signing.SigningError):
         signing.sign_file(self.file_)
     assert not self.file_.is_signed
     assert not self.file_.cert_serial_num
     assert not self.file_.hash
     assert not signing.is_signed(self.file_.file_path)
Esempio n. 3
0
 def test_no_sign_missing_file(self):
     os.unlink(self.file_.file_path)
     assert not self.file_.is_signed
     assert not self.file_.cert_serial_num
     assert not self.file_.hash
     with self.assertRaises(signing.SigningError):
         signing.sign_file(self.file_)
     assert not self.file_.is_signed
     assert not self.file_.cert_serial_num
     assert not self.file_.hash
     assert not signing.is_signed(self.file_.file_path)
Esempio n. 4
0
    def test_sign_file_multi_package(self):
        fpath = 'src/olympia/files/fixtures/files/multi-package.xpi'
        with amo.tests.copy_file(fpath, self.file_.file_path, overwrite=True):
            self.file_.update(is_multi_package=True)
            self.assert_not_signed()

            signing.sign_file(self.file_)
            self.assert_not_signed()
            # The multi-package itself isn't signed.
            assert not signing.is_signed(self.file_.file_path)
            # The internal extensions aren't either.
            folder = tempfile.mkdtemp(dir=settings.TMP_PATH)
            try:
                extract_xpi(self.file_.file_path, folder)
                # The extension isn't.
                assert not signing.is_signed(
                    os.path.join(folder, 'random_extension.xpi'))
                # And the theme isn't either.
                assert not signing.is_signed(
                    os.path.join(folder, 'random_theme.xpi'))
            finally:
                amo.utils.rm_local_tmp_dir(folder)
Esempio n. 5
0
 def assert_signed(self):
     assert self.file_.is_signed
     assert self.file_.cert_serial_num
     assert self.file_.hash
     assert signing.is_signed(self.file_.file_path)
Esempio n. 6
0
 def test_is_signed(self):
     assert not signing.is_signed(self.file_.file_path)
     signing.sign_file(self.file_)
     assert signing.is_signed(self.file_.file_path)
Esempio n. 7
0
 def assert_signed(self):
     assert self.file_.is_signed
     assert self.file_.cert_serial_num
     assert self.file_.hash
     assert signing.is_signed(self.file_.file_path)
Esempio n. 8
0
 def test_is_signed(self):
     assert not signing.is_signed(self.file_.file_path)
     signing.sign_file(self.file_)
     assert signing.is_signed(self.file_.file_path)