Esempio n. 1
0
    def setUp(self):
        self.task_payload = {
            'google_play_track': 'alpha'
        }

        self.products = {
            'aurora': {
                'has_nightly_track': False,
                'service_account': 'aurora_account',
                'certificate': '/path/to/aurora.p12',
                'skip_check_package_names': True,
            },
            'beta': {
                'has_nightly_track': False,
                'service_account': 'beta_account',
                'certificate': '/path/to/beta.p12',
                'skip_check_package_names': True,
            },
            'release': {
                'has_nightly_track': False,
                'service_account': 'release_account',
                'certificate': '/path/to/release.p12',
                'skip_check_package_names': True,
            },
            'dep': {
                'has_nightly_track': False,
                'service_account': 'dummy_dep',
                'certificate': '/path/to/dummy_non_p12_file',
                'skip_check_package_names': True,
                'skip_check_ordered_version_codes': True,
                'skip_checks_fennec': True,
            }
        }
        self.apks = [MockFile('/path/to/x86.apk'), MockFile('/path/to/arm_v15.apk')]
Esempio n. 2
0
    def test_publish_config(self, mock_push_apk):
        android_products = ('aurora', 'beta', 'release')
        for android_product in android_products:
            publish_to_googleplay(self.task_payload, self.products[android_product], self.apks, contact_google_play=True)

            mock_push_apk.assert_called_with(
                apks=[MockFile('/path/to/x86.apk'), MockFile('/path/to/arm_v15.apk')],
                service_account='{}_account'.format(android_product),
                google_play_credentials_file=MockFile('/path/to/{}.p12'.format(android_product)),
                track='alpha',
                package_names_check=ANY,
                rollout_percentage=None,
                google_play_strings=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 = mock_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)
Esempio n. 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)
Esempio n. 4
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,
        )
Esempio n. 5
0
 def setUp(self):
     self.publish_config = {
         'target_store': 'google',
         'dry_run': True,
         'google_track': 'beta',
         'package_names': ['org.mozilla.fennec_aurora'],
         'username': '******',
         'secret': '/google_credentials.p12',
     }
     self.apks = [
         MockFile('/path/to/x86.apk'),
         MockFile('/path/to/arm_v15.apk')
     ]
Esempio n. 6
0
 def test_publish_updates_google_strings_from_file(self, mock_push_apk):
     publish_to_googleplay(self.task_payload, self.products['release'], self.apks, contact_google_play=True,
                           google_play_strings_file=MockFile('/path/to/google_play_strings.json'))
     _, args = mock_push_apk.call_args
     google_play_strings = args['google_play_strings']
     assert isinstance(google_play_strings, FileGooglePlayStrings)
     assert google_play_strings.file.name == '/path/to/google_play_strings.json'
Esempio n. 7
0
    def test_publish_config(self, mock_push_apk):
        publish({}, self.publish_config, self.apks, contact_server=True)

        mock_push_apk.assert_called_with(
            apks=[
                MockFile('/path/to/x86.apk'),
                MockFile('/path/to/arm_v15.apk')
            ],
            target_store='google',
            username='******',
            secret='/google_credentials.p12',
            track='beta',
            expected_package_names=['org.mozilla.fennec_aurora'],
            rollout_percentage=None,
            dry_run=True,
            contact_server=True,
            skip_check_multiple_locales=False,
            skip_check_ordered_version_codes=False,
            skip_check_same_locales=False,
            skip_checks_fennec=False,
        )