From b06494c44da116b47c6e6bc15ac017033a8b021f Mon Sep 17 00:00:00 2001 From: Mitchell Hentges Date: Thu, 25 Jul 2019 08:25:40 -0700 Subject: [PATCH] Removes edit_resource.validate() --- mozapkpublisher/check_rollout.py | 4 ++-- mozapkpublisher/common/googleplay.py | 3 +-- mozapkpublisher/push_apk.py | 4 ++-- mozapkpublisher/test/common/test_googleplay.py | 4 ++-- mozapkpublisher/test/test_push_apk.py | 2 +- mozapkpublisher/update_apk_description.py | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/mozapkpublisher/check_rollout.py b/mozapkpublisher/check_rollout.py index 105ab295..ca013c0c 100755 --- a/mozapkpublisher/check_rollout.py +++ b/mozapkpublisher/check_rollout.py @@ -41,8 +41,8 @@ def main(): type=int, default=7) config = parser.parse_args() - with googleplay.edit(True, config.service_account, config.google_play_credentials_file.name, - 'org.mozilla.firefox', commit=False) as edit: + with googleplay.edit(config.service_account, config.google_play_credentials_file.name, + 'org.mozilla.firefox', contact_google_play=True, commit=False) as edit: for (release, age) in check_rollout(edit, config.days): print('fennec {} is on staged rollout at {}% but it shipped {} days ago'.format( release['name'], int(release['userFraction'] * 100), int(age / DAY))) diff --git a/mozapkpublisher/common/googleplay.py b/mozapkpublisher/common/googleplay.py index 8fc3534c..f8f0927a 100644 --- a/mozapkpublisher/common/googleplay.py +++ b/mozapkpublisher/common/googleplay.py @@ -146,7 +146,7 @@ def update_whats_new(self, language, apk_version_code, whats_new): @contextmanager -def edit(contact_google_play, service_account, credentials_file_name, package_name, *, commit): +def edit(service_account, credentials_file_name, package_name, *, contact_google_play, commit): edit_resource = edit_resource_for_options(contact_google_play, service_account, credentials_file_name) edit_id = edit_resource.insert(body={}, packageName=package_name).execute()['id'] google_play = GooglePlayEdit(edit_resource, edit_id, package_name) @@ -156,7 +156,6 @@ def edit(contact_google_play, service_account, credentials_file_name, package_na logger.info('Changes committed') logger.debug('edit_id "{}" for "{}" has been committed'.format(edit_id, package_name)) else: - edit_resource.validate() logger.warning('Transaction not committed, since `commit` was `False`') diff --git a/mozapkpublisher/push_apk.py b/mozapkpublisher/push_apk.py index f529edac..b0edbd19 100755 --- a/mozapkpublisher/push_apk.py +++ b/mozapkpublisher/push_apk.py @@ -66,8 +66,8 @@ def push_apk( # by package name here. split_apk_metadata = _split_apk_metadata_per_package_name(apks_metadata_per_paths) for (package_name, apks_metadata) in split_apk_metadata.items(): - with googleplay.edit(contact_google_play, service_account, google_play_credentials_file.name, - package_name, commit=commit) as edit: + with googleplay.edit(service_account, google_play_credentials_file.name, package_name, + contact_google_play=contact_google_play, commit=commit) as edit: for path, metadata in apks_metadata_per_paths.items(): edit.upload_apk(path) diff --git a/mozapkpublisher/test/common/test_googleplay.py b/mozapkpublisher/test/common/test_googleplay.py index 1cb1c0e3..96f9883c 100644 --- a/mozapkpublisher/test/common/test_googleplay.py +++ b/mozapkpublisher/test/common/test_googleplay.py @@ -48,7 +48,7 @@ def edit_resource_mock(): def test_google_play_edit_no_commit_transaction(edit_resource_for_options_): mock_edits_resource = MagicMock() edit_resource_for_options_.return_value = mock_edits_resource - with googleplay.edit(False, None, None, 'package.name', commit=False) as _: + with googleplay.edit(None, None, 'package.name', contact_google_play=False, commit=False) as _: pass mock_edits_resource.commit.assert_not_called() @@ -58,7 +58,7 @@ def test_google_play_edit_no_commit_transaction(edit_resource_for_options_): def test_google_play_edit_commit_transaction(edit_resource_for_options_): mock_edits_resource = MagicMock() edit_resource_for_options_.return_value = mock_edits_resource - with googleplay.edit(False, None, None, 'package.name', commit=True) as _: + with googleplay.edit(None, None, 'package.name', contact_google_play=False, commit=True) as _: pass mock_edits_resource.commit.assert_called_with(editId=ANY, packageName='package.name') diff --git a/mozapkpublisher/test/test_push_apk.py b/mozapkpublisher/test/test_push_apk.py index 665a62e1..0a4d0754 100644 --- a/mozapkpublisher/test/test_push_apk.py +++ b/mozapkpublisher/test/test_push_apk.py @@ -75,7 +75,7 @@ def _metadata(*args, **kwargs): } @contextmanager - def fake_edit(_, __, ___, ____, *, commit): + def fake_edit(_, __, ___, *, contact_google_play, commit): yield google_play_edit_mock_ monkeypatch_.setattr(googleplay, 'edit', fake_edit) diff --git a/mozapkpublisher/update_apk_description.py b/mozapkpublisher/update_apk_description.py index 030363d3..38e07f18 100755 --- a/mozapkpublisher/update_apk_description.py +++ b/mozapkpublisher/update_apk_description.py @@ -11,8 +11,8 @@ def update_apk_description(package_name, force_locale, commit, service_account, google_play_credentials_file, contact_google_play): - with googleplay.edit(contact_google_play, service_account, google_play_credentials_file.name, - package_name, commit=commit) as edit: + with googleplay.edit(service_account, google_play_credentials_file.name, package_name, + contact_google_play=contact_google_play, commit=commit) as edit: moz_locales = [force_locale] if force_locale else None l10n_strings = store_l10n.get_translations_per_google_play_locale_code(package_name, moz_locales) create_or_update_listings(edit, l10n_strings)