def test_create_ios_app_already_exists(ios_app):
    del ios_app

    with pytest.raises(project_management.ApiCallError) as excinfo:
        project_management.create_ios_app(
            bundle_id=TEST_APP_BUNDLE_ID, display_name=TEST_APP_DISPLAY_NAME_PREFIX)
    assert 'The resource already exists' in str(excinfo.value)
    assert excinfo.value.detail is not None
def test_create_ios_app_already_exists(ios_app):
    del ios_app

    with pytest.raises(exceptions.AlreadyExistsError) as excinfo:
        project_management.create_ios_app(
            bundle_id=TEST_APP_BUNDLE_ID,
            display_name=TEST_APP_DISPLAY_NAME_PREFIX)
    assert 'Requested entity already exists' in str(excinfo.value)
    assert excinfo.value.cause is not None
    assert excinfo.value.http_response is not None
def ios_app(default_app):
    del default_app
    ios_apps = project_management.list_ios_apps()
    for ios_app in ios_apps:
        if _starts_with(ios_app.get_metadata().display_name, TEST_APP_DISPLAY_NAME_PREFIX):
            return ios_app
    return project_management.create_ios_app(
        bundle_id=TEST_APP_BUNDLE_ID, display_name=TEST_APP_DISPLAY_NAME_PREFIX)