Example #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
            ),
        })
Example #2
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',
            })
Example #3
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)
Example #4
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',
            })