def test_edit_service_is_allowed_to_not_make_a_single_call_to_google_play(
        monkeypatch):
    edit_service_mock = set_up_edit_service_mock(monkeypatch)
    edit_service = EditService('service_account',
                               'credentials_file_path',
                               'dummy_package_name',
                               commit=True,
                               contact_google_play=False)
    upload_apk_result = edit_service.upload_apk(apk_path='/path/to/dummy.apk')
    edit_service.update_listings(language='some_language',
                                 title='some_title',
                                 full_description='some_description',
                                 short_description='some_desc')
    edit_service.update_track(track='some_track', version_codes=['1', '2'])
    edit_service.update_whats_new(language='some_language',
                                  apk_version_code='some_version_code',
                                  whats_new='some_text')
    edit_service.commit_transaction()

    assert upload_apk_result == {
        'versionCode': 'fake-version-code'
    }  # Value set when contact_google_play is False
    edit_service_mock.apks().upload.assert_not_called()
    edit_service_mock.apklistings().update.assert_not_called()
    edit_service_mock.tracks().update.assert_not_called()
    edit_service_mock.apklistings().update.assert_not_called()
    edit_service_mock.commit.assert_not_called()
def test_update_track_should_refuse_wrong_percentage(monkeypatch,
                                                     invalid_percentage):
    set_up_edit_service_mock(monkeypatch)
    edit_service = EditService('service_account', 'credentials_file_path',
                               'dummy_package_name')

    with pytest.raises(WrongArgumentGiven):
        edit_service.update_track('rollout', ['2015012345', '2015012347'],
                                  invalid_percentage)
Esempio n. 3
0
def test_update_track(monkeypatch):
    edit_mock = set_up_edit_service_mock(monkeypatch)
    edit_service = EditService('service_account', 'credentials_file_path', 'dummy_package_name')

    edit_service.update_track('alpha', ['2015012345', '2015012347'])
    edit_mock.tracks().update.assert_called_once_with(
        editId=edit_service._edit_id,
        packageName='dummy_package_name',
        track='alpha',
        body={u'versionCodes': ['2015012345', '2015012347']}
    )

    edit_mock.tracks().update.reset_mock()
    edit_service.update_track('rollout', ['2015012345', '2015012347'], rollout_percentage=1)
    edit_mock.tracks().update.assert_called_once_with(
        editId=edit_service._edit_id,
        packageName='dummy_package_name',
        track='rollout',
        body={u'userFraction': 0.01, u'versionCodes': ['2015012345', '2015012347']}
    )