Skip to content

Commit

Permalink
Removes edit_resource.validate()
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitchell Hentges committed Jul 25, 2019
1 parent 592768e commit b06494c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions mozapkpublisher/check_rollout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
3 changes: 1 addition & 2 deletions mozapkpublisher/common/googleplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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`')


Expand Down
4 changes: 2 additions & 2 deletions mozapkpublisher/push_apk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions mozapkpublisher/test/common/test_googleplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion mozapkpublisher/test/test_push_apk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions mozapkpublisher/update_apk_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b06494c

Please sign in to comment.