Commit 1dcb1197 authored by Mark Chao's avatar Mark Chao

Return connection error for activation

Use different key to be distinguishable
parent bc88a28e
......@@ -6,6 +6,8 @@ module Gitlab
module Graphql
extend ActiveSupport::Concern
CONNECTIVITY_ERROR = 'CONNECTIVITY_ERROR'
class_methods do
def activate(activation_code)
uuid = Gitlab::CurrentSettings.uuid
......@@ -33,9 +35,7 @@ module Gitlab
{ query: query, variables: variables }
)
if !response[:success] || response.dig(:data, 'errors').present?
return error(response.dig(:data, 'errors'))
end
return error(CONNECTIVITY_ERROR) unless response[:success]
response = response.dig(:data, 'data', 'cloudActivationActivate')
......
......@@ -49,6 +49,14 @@ RSpec.describe Gitlab::SubscriptionPortal::Clients::Graphql do
expect(result).to eq({ errors: ["invalid activation code"], success: false })
end
it 'returns connectivity error' do
stub_request(:any, EE::SUBSCRIPTIONS_GRAPHQL_URL).to_return(status: [500, "Internal Server Error"])
result = client.activate('activation_code_abc')
expect(result).to eq({ errors: described_class::CONNECTIVITY_ERROR, success: false })
end
end
describe '#plan_upgrade_offer' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment