Пример #1
0
    def test_main_allows_google_play_strings_file_and_commit_transaction(self, PushAPK):
        task_generator = TaskGenerator(should_commit_transaction=True)
        task_generator.generate_file(self.config_generator.work_dir)

        self._copy_all_apks_to_test_temp_dir(task_generator)
        self._copy_single_file_to_test_temp_dir(
            task_id=task_generator.google_play_strings_task_id,
            origin_file_name='google_play_strings.json',
            destination_path='public/google_play_strings.json',
        )
        main(config_path=self.config_generator.generate())

        PushAPK.assert_called_with(config={
            '*args': sorted([
                '{}/work/cot/{}/public/build/target.apk'.format(self.test_temp_dir, task_generator.arm_task_id),
                '{}/work/cot/{}/public/build/target.apk'.format(self.test_temp_dir, task_generator.x86_task_id),
            ]),
            'credentials': '/dummy/path/to/certificate.p12',
            'commit': True,
            'service_account': '*****@*****.**',
            'track': 'alpha',
            'update_gp_strings_from_file': '{}/work/cot/{}/public/google_play_strings.json'.format(
                self.test_temp_dir, task_generator.google_play_strings_task_id
            ),
        })
Пример #2
0
    def test_main_allows_rollout_percentage(self, push_apk):
        task_generator = TaskGenerator(google_play_track='rollout', rollout_percentage=25)
        task_generator.generate_file(self.config_generator.work_dir)

        self._copy_all_apks_to_test_temp_dir(task_generator)
        main(config_path=self.config_generator.generate())

        push_apk.assert_called_with(
            apks=[
                MockFile(
                    '{}/work/cot/{}/public/build/target.apk'.format(self.test_temp_dir, task_generator.arm_task_id)),
                MockFile(
                    '{}/work/cot/{}/public/build/target.apk'.format(self.test_temp_dir, task_generator.x86_task_id)),
            ],
            service_account='*****@*****.**',
            google_play_credentials_file=MockFile('/dummy/path/to/certificate.p12'),
            track='rollout',
            package_names_check=unittest.mock.ANY,
            rollout_percentage=25,
            google_play_strings=unittest.mock.ANY,
            commit=False,
            contact_google_play=True,
            skip_check_multiple_locales=False,
            skip_check_ordered_version_codes=False,
            skip_check_same_locales=False,
            skip_checks_fennec=False,
        )
        _, args = push_apk.call_args
        package_names_check = args['package_names_check']
        google_play_strings = args['google_play_strings']
        assert isinstance(package_names_check, AnyPackageNamesCheck)
        assert isinstance(google_play_strings, NoGooglePlayStrings)
Пример #3
0
    def test_main_allows_commit_transaction(self, push_apk):
        task_generator = TaskGenerator(should_commit_transaction=True)

        self.write_task_file(task_generator.generate_task('aurora'))

        self._copy_all_apks_to_test_temp_dir(task_generator)
        self.keystore_manager.add_certificate('nightly')
        main(config_path=self.config_generator.generate_fennec_config())

        push_apk.assert_called_with(
            apks=[
                MockFile(
                    '{}/work/cot/{}/public/build/target.apk'.format(self.test_temp_dir, task_generator.arm_task_id)),
                MockFile(
                    '{}/work/cot/{}/public/build/target.apk'.format(self.test_temp_dir, task_generator.x86_task_id)),
            ],
            target_store='google',
            username='******',
            secret='/firefox-nightly.p12',
            track='beta',
            expected_package_names=['org.mozilla.fennec_aurora'],
            rollout_percentage=None,
            dry_run=False,
            contact_server=True,
            skip_check_multiple_locales=False,
            skip_check_ordered_version_codes=False,
            skip_check_same_locales=False,
            skip_checks_fennec=False,
        )
Пример #4
0
    def test_main_allows_rollout_percentage(self, PushAPK):
        task_generator = TaskGenerator(google_play_track='rollout',
                                       rollout_percentage=25)
        task_generator.generate_file(self.config_generator.work_dir)

        self._copy_all_apks_to_test_temp_dir(task_generator)
        main(config_path=self.config_generator.generate())

        PushAPK.assert_called_with(
            config={
                'credentials':
                '/dummy/path/to/certificate.p12',
                '*args':
                sorted([
                    '{}/work/cot/{}/public/build/target.apk'.format(
                        self.test_temp_dir, task_generator.arm_task_id),
                    '{}/work/cot/{}/public/build/target.apk'.format(
                        self.test_temp_dir, task_generator.x86_task_id),
                ]),
                'credentials':
                '/dummy/path/to/certificate.p12',
                'commit':
                False,
                'no_gp_string_update':
                True,
                'rollout_percentage':
                25,
                'service_account':
                '*****@*****.**',
                'track':
                'rollout',
            })
Пример #5
0
    def test_main_downloads_verifies_signature_and_gives_the_right_config_to_mozapkpublisher(
            self, PushAPK):
        task_generator = TaskGenerator()
        task_generator.generate_file(self.config_generator.work_dir)

        self._copy_all_apks_to_test_temp_dir(task_generator)
        main(config_path=self.config_generator.generate())

        PushAPK.assert_called_with(
            config={
                'credentials':
                '/dummy/path/to/certificate.p12',
                '*args':
                sorted([
                    '{}/work/cot/{}/public/build/target.apk'.format(
                        self.test_temp_dir, task_generator.arm_task_id),
                    '{}/work/cot/{}/public/build/target.apk'.format(
                        self.test_temp_dir, task_generator.x86_task_id),
                ]),
                'commit':
                False,
                'credentials':
                '/dummy/path/to/certificate.p12',
                'no_gp_string_update':
                True,
                'service_account':
                '*****@*****.**',
                'track':
                'alpha',
            })
Пример #6
0
def test_validate_task(context):
    context.task = TaskGenerator().generate_task('aurora')
    validate_task_schema(context)
Пример #7
0
 def test_validate_task(self):
     self.context.task = TaskGenerator().generate_json()
     validate_task_schema(self.context)
Пример #8
0
def test_validate_task(context):
    context.task = TaskGenerator().generate_json()
    validate_task_schema(context)