diff options
Diffstat (limited to 'spec/requests/projects/google_cloud/configuration_controller_spec.rb')
-rw-r--r-- | spec/requests/projects/google_cloud/configuration_controller_spec.rb | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/spec/requests/projects/google_cloud/configuration_controller_spec.rb b/spec/requests/projects/google_cloud/configuration_controller_spec.rb index 08d4ad2f9ba..41593b8d7a7 100644 --- a/spec/requests/projects/google_cloud/configuration_controller_spec.rb +++ b/spec/requests/projects/google_cloud/configuration_controller_spec.rb @@ -2,9 +2,6 @@ require 'spec_helper' -# Mock Types -MockGoogleOAuth2Credentials = Struct.new(:app_id, :app_secret) - RSpec.describe Projects::GoogleCloud::ConfigurationController do let_it_be(:project) { create(:project, :public) } let_it_be(:url) { project_google_cloud_configuration_path(project) } @@ -29,10 +26,9 @@ RSpec.describe Projects::GoogleCloud::ConfigurationController do get url expect_snowplow_event( - category: 'Projects::GoogleCloud', - action: 'admin_project_google_cloud!', - label: 'error_access_denied', - property: 'invalid_user', + category: 'Projects::GoogleCloud::ConfigurationController', + action: 'error_invalid_user', + label: nil, project: project, user: unauthorized_member ) @@ -56,7 +52,7 @@ RSpec.describe Projects::GoogleCloud::ConfigurationController do context 'but gitlab instance is not configured for google oauth2' do it 'returns forbidden' do - unconfigured_google_oauth2 = MockGoogleOAuth2Credentials.new('', '') + unconfigured_google_oauth2 = Struct.new(:app_id, :app_secret).new('', '') allow(Gitlab::Auth::OAuth::Provider).to receive(:config_for) .with('google_oauth2') .and_return(unconfigured_google_oauth2) @@ -68,11 +64,9 @@ RSpec.describe Projects::GoogleCloud::ConfigurationController do expect(response).to have_gitlab_http_status(:forbidden) expect_snowplow_event( - category: 'Projects::GoogleCloud', - action: 'google_oauth2_enabled!', - label: 'error_access_denied', - extra: { reason: 'google_oauth2_not_configured', - config: unconfigured_google_oauth2 }, + category: 'Projects::GoogleCloud::ConfigurationController', + action: 'error_google_oauth2_not_enabled', + label: nil, project: project, user: authorized_member ) @@ -93,10 +87,9 @@ RSpec.describe Projects::GoogleCloud::ConfigurationController do expect(response).to have_gitlab_http_status(:not_found) expect_snowplow_event( - category: 'Projects::GoogleCloud', - action: 'feature_flag_enabled!', - label: 'error_access_denied', - property: 'feature_flag_not_enabled', + category: 'Projects::GoogleCloud::ConfigurationController', + action: 'error_feature_flag_not_enabled', + label: nil, project: project, user: authorized_member ) @@ -117,20 +110,9 @@ RSpec.describe Projects::GoogleCloud::ConfigurationController do expect(response).to be_successful expect_snowplow_event( - category: 'Projects::GoogleCloud', - action: 'configuration#index', - label: 'success', - extra: { - configurationUrl: project_google_cloud_configuration_path(project), - deploymentsUrl: project_google_cloud_deployments_path(project), - databasesUrl: project_google_cloud_databases_path(project), - serviceAccounts: [], - createServiceAccountUrl: project_google_cloud_service_accounts_path(project), - emptyIllustrationUrl: ActionController::Base.helpers.image_path('illustrations/pipelines_empty.svg'), - configureGcpRegionsUrl: project_google_cloud_gcp_regions_path(project), - gcpRegions: [], - revokeOauthUrl: nil - }, + category: 'Projects::GoogleCloud::ConfigurationController', + action: 'render_page', + label: nil, project: project, user: authorized_member ) |