예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
파일: tests.py 프로젝트: kmaglione/olympia
 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)
예제 #4
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
     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)
예제 #5
0
파일: tests.py 프로젝트: Nolski/olympia
    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)
예제 #6
0
파일: tests.py 프로젝트: Nolski/olympia
    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)
예제 #7
0
파일: tests.py 프로젝트: kmaglione/olympia
 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)
예제 #8
0
파일: tests.py 프로젝트: kmaglione/olympia
 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)
예제 #9
0
 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
예제 #10
0
 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)
예제 #11
0
파일: tests.py 프로젝트: ujdhesa/olympia
 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
예제 #12
0
파일: tests.py 프로젝트: zuzelvp/olympia
 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)