Пример #1
0
def test_google_update_track_should_refuse_wrong_percentage(
        edit_resource_mock, invalid_percentage):
    google_play = GooglePlayEdit(edit_resource_mock, 1, 'dummy_package_name')

    with pytest.raises(WrongArgumentGiven):
        google_play._update_track('production', ['2015012345', '2015012347'],
                                  invalid_percentage)
Пример #2
0
def test_google_update_app():
    edit = GooglePlayEdit(edit_resource_mock, 1, 'dummy_package_name')
    edit.upload_apk = MagicMock()
    edit._update_track = MagicMock()
    apk_mock = Mock()
    apk_mock.name = '/path/to/dummy.apk'
    edit.update_app([(apk_mock, {'version_code': 1})], 'alpha')

    edit.upload_apk.assert_called_once_with(apk_mock)
    edit._update_track.assert_called_once_with('alpha', [1], None)
Пример #3
0
def test_google_update_track(edit_resource_mock):
    google_play = GooglePlayEdit(edit_resource_mock, 1, 'dummy_package_name')

    google_play._update_track('alpha', ['2015012345', '2015012347'])
    edit_resource_mock.tracks().update.assert_called_once_with(
        editId=google_play._edit_id,
        packageName='dummy_package_name',
        track='alpha',
        body={
            'releases': [{
                'status': 'completed',
                'versionCodes': ['2015012345', '2015012347'],
            }],
            'track':
            'alpha',
        },
    )

    edit_resource_mock.tracks().update.reset_mock()
    google_play._update_track('production', ['2015012345', '2015012347'],
                              rollout_percentage=1)
    edit_resource_mock.tracks().update.assert_called_once_with(
        editId=google_play._edit_id,
        packageName='dummy_package_name',
        track='production',
        body={
            'releases': [
                {
                    'status': 'inProgress',
                    'userFraction': 0.01,
                    'versionCodes': ['2015012345', '2015012347']
                },
            ],
            'track':
            'production',
        },
    )