def test_sign_file_multi_package(self): with amo.tests.copy_file('apps/files/fixtures/files/multi-package.xpi', self.file_.file_path, overwrite=True): self.file_.update(is_multi_package=True) self.assert_not_signed() # Make sure the internal XPIs aren't signed either. folder = tempfile.mkdtemp() try: extract_xpi(self.file_.file_path, folder) assert not packaged.is_signed( os.path.join(folder, 'random_extension.xpi')) assert not packaged.is_signed( os.path.join(folder, 'random_theme.xpi')) finally: amo.utils.rm_local_tmp_dir(folder) packaged.sign_file(self.file_, settings.SIGNING_SERVER) assert self.file_.is_signed assert self.file_.cert_serial_num assert self.file_.hash # It's not the multi-package itself that is signed. assert not packaged.is_signed(self.file_.file_path) # It's the internal xpi. folder = tempfile.mkdtemp() try: extract_xpi(self.file_.file_path, folder) assert packaged.is_signed( os.path.join(folder, 'random_extension.xpi')) # And only the one that is an extension. assert not packaged.is_signed( os.path.join(folder, 'random_theme.xpi')) finally: amo.utils.rm_local_tmp_dir(folder)
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 packaged.sign_file(self.file_, settings.SIGNING_SERVER) assert not self.file_.is_signed assert not self.file_.cert_serial_num assert not self.file_.hash assert not packaged.is_signed(self.file_.file_path)
def test_sign_file_multi_package(self): with amo.tests.copy_file("apps/files/fixtures/files/multi-package.xpi", self.file_.file_path, overwrite=True): self.file_.update(is_multi_package=True) self.assert_not_signed() packaged.sign_file(self.file_, settings.SIGNING_SERVER) self.assert_not_signed() # The multi-package itself isn't signed. assert not packaged.is_signed(self.file_.file_path) # The internal extensions aren't either. folder = tempfile.mkdtemp() try: extract_xpi(self.file_.file_path, folder) # The extension isn't. assert not packaged.is_signed(os.path.join(folder, "random_extension.xpi")) # And the theme isn't either. assert not packaged.is_signed(os.path.join(folder, "random_theme.xpi")) finally: amo.utils.rm_local_tmp_dir(folder)
def test_sign_file_multi_package(self): with amo.tests.copy_file('apps/files/fixtures/files/multi-package.xpi', self.file_.file_path, overwrite=True): self.file_.update(is_multi_package=True) self.assert_not_signed() packaged.sign_file(self.file_, settings.SIGNING_SERVER) self.assert_not_signed() # The multi-package itself isn't signed. assert not packaged.is_signed(self.file_.file_path) # The internal extensions aren't either. folder = tempfile.mkdtemp() try: extract_xpi(self.file_.file_path, folder) # The extension isn't. assert not packaged.is_signed( os.path.join(folder, 'random_extension.xpi')) # And the theme isn't either. assert not packaged.is_signed( os.path.join(folder, 'random_theme.xpi')) finally: amo.utils.rm_local_tmp_dir(folder)
def assert_signed(self): assert self.file_.is_signed assert self.file_.cert_serial_num assert self.file_.hash assert packaged.is_signed(self.file_.file_path)
def test_is_signed(self): assert not packaged.is_signed(self.file_.file_path) packaged.sign_file(self.file_, settings.SIGNING_SERVER) assert packaged.is_signed(self.file_.file_path)
def assert_signed(self): assert self.file_.is_signed assert self.file_.cert_serial_num assert self.file_.hash assert packaged.is_signed(self.file_.file_path) assert len(self.requests_post_calls) == 1