summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Walker <bwalker@gitlab.com>2018-01-06 15:34:11 +0100
committerBrett Walker <bwalker@gitlab.com>2018-01-22 17:25:10 +0100
commitb9ab2e26f97c3fef0d26c5d75d1066e4645ac27f (patch)
treee1f406272b611fd1c780383710dd67b817d9fa95
parent75504fc9ef5425b64809bc6c786a289be0af227a (diff)
downloadgitlab-ce-b9ab2e26f97c3fef0d26c5d75d1066e4645ac27f.tar.gz
fix static analysis issues
-rw-r--r--qa/qa/runtime/api.rb14
-rw-r--r--qa/qa/specs/features/api/users_spec.rb4
-rw-r--r--qa/qa/support/api_helpers.rb2
3 files changed, 8 insertions, 12 deletions
diff --git a/qa/qa/runtime/api.rb b/qa/qa/runtime/api.rb
index a2b4210f910..7031aea3098 100644
--- a/qa/qa/runtime/api.rb
+++ b/qa/qa/runtime/api.rb
@@ -3,6 +3,8 @@ require 'faraday'
module QA
module Runtime
class API
+ VERSION = 'v4'
+
##
# GET an endpoint that belongs to a GitLab instance under a given address
#
@@ -18,11 +20,7 @@ module QA
page = self.add_query_values(page, args)
response = Faraday.get(API::Session.new(address, page).address)
json = response.status == 200 ? JSON.parse(response.body) : nil
- return response, json
- end
-
- def self.version
- 'v4'
+ [response, json]
end
def self.add_query_values(path, args)
@@ -38,6 +36,8 @@ module QA
end
class Session
+ attr_reader :address
+
def initialize(instance, page = nil)
@instance = instance
@address = host + (page.is_a?(String) ? page : page&.path)
@@ -46,10 +46,6 @@ module QA
def host
@instance.is_a?(Symbol) ? Runtime::Scenario.send("#{@instance}_address") : @instance.to_s
end
-
- def address
- @address
- end
end
end
end
diff --git a/qa/qa/specs/features/api/users_spec.rb b/qa/qa/specs/features/api/users_spec.rb
index f32ac674d7a..5577384a28d 100644
--- a/qa/qa/specs/features/api/users_spec.rb
+++ b/qa/qa/specs/features/api/users_spec.rb
@@ -9,7 +9,7 @@ module QA
context "when authenticated" do
scenario 'get list of users' do
- response, json = Runtime::API.get(:gitlab, api('/users', personal_access_token: @access_token))
+ response, _json = Runtime::API.get(:gitlab, api('/users', personal_access_token: @access_token))
expect(response).to have_gitlab_api_status(200)
end
@@ -24,7 +24,7 @@ module QA
end
scenario "returns authorization error when token is invalid" do
- response, json = Runtime::API.get(:gitlab, api('/users', personal_access_token: 'invalid'))
+ response, _json = Runtime::API.get(:gitlab, api('/users', personal_access_token: 'invalid'))
expect(response).to have_gitlab_api_status(401)
end
diff --git a/qa/qa/support/api_helpers.rb b/qa/qa/support/api_helpers.rb
index 092f16afabe..7f834f6d4fc 100644
--- a/qa/qa/support/api_helpers.rb
+++ b/qa/qa/support/api_helpers.rb
@@ -19,7 +19,7 @@ module QA
# => "/api/v2/issues?foo=bar&private_token=..."
#
# Returns the relative path to the requested API resource
- def api(path, version: QA::Runtime::API.version, personal_access_token: nil, oauth_access_token: nil)
+ def api(path, version: Runtime::API::VERSION, personal_access_token: nil, oauth_access_token: nil)
full_path = "/api/#{version}#{path}"
if oauth_access_token