diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-10 13:40:11 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-10 13:40:11 +0200 |
commit | 6120dc261ab3700b7a19f683559494319b6a1b75 (patch) | |
tree | 9b9c9b0c5664f03af9732ebf3c0d01079533df94 /spec/support/api_helpers.rb | |
parent | 6c477d5b9496829eb5cb56ef32a0dd813be7dc16 (diff) | |
parent | cd735170d3bc5e71d46ba1e37249ae713b7842f8 (diff) | |
download | gitlab-ce-6120dc261ab3700b7a19f683559494319b6a1b75.tar.gz |
Merge branch 'master' into backstage/gb/migrate-stages-statuses
* master: (587 commits)
Increase GitLab QA screenshots size
Fix QA test scenario for creating a new project
Configure headless chrome screenshots correctly
Allow passing exceptions when creating project services
Also inject new route helpers into includers of GitlabRoutingHelper
Remove many N+1 queries with merge requests API
fix milestones finder failing spec
Make wrong migrations idempotent
Remove double border on last group row
Update tests to test what the component renders and what the clicks calls
Username and password are no longer stripped from import url on import
Change `sign_out` usage to `gitlab_sign_out` in one spec
Send Gitaly Repository with /api/internal/allowed
Resolve "Liberation Mono weird font rendering on Fedora/openSUSE/other Linux distros"
Force mobile view for admin projects
fix spec
Mark a subgroup-related spec as PostgreSQL-only
Use vue .prevent to prevent the click
Add members-list class to admin projects page
Fix another typo in SHA attribute spec
...
Conflicts:
db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
db/schema.rb
lib/gitlab/background_migration/migrate_build_stage_id_reference.rb
spec/migrations/migrate_stage_id_reference_in_background_spec.rb
Diffstat (limited to 'spec/support/api_helpers.rb')
-rw-r--r-- | spec/support/api_helpers.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/support/api_helpers.rb b/spec/support/api_helpers.rb index 35d1e1cfc7d..ac0aaa524b7 100644 --- a/spec/support/api_helpers.rb +++ b/spec/support/api_helpers.rb @@ -17,14 +17,18 @@ module ApiHelpers # => "/api/v2/issues?foo=bar&private_token=..." # # Returns the relative path to the requested API resource - def api(path, user = nil, version: API::API.version) + def api(path, user = nil, version: API::API.version, personal_access_token: nil, oauth_access_token: nil) "/api/#{version}#{path}" + # Normalize query string (path.index('?') ? '' : '?') + + if personal_access_token.present? + "&private_token=#{personal_access_token.token}" + elsif oauth_access_token.present? + "&access_token=#{oauth_access_token.token}" # Append private_token if given a User object - if user.respond_to?(:private_token) + elsif user.respond_to?(:private_token) "&private_token=#{user.private_token}" else '' @@ -32,8 +36,14 @@ module ApiHelpers end # Temporary helper method for simplifying V3 exclusive API specs - def v3_api(path, user = nil) - api(path, user, version: 'v3') + def v3_api(path, user = nil, personal_access_token: nil, oauth_access_token: nil) + api( + path, + user, + version: 'v3', + personal_access_token: personal_access_token, + oauth_access_token: oauth_access_token + ) end def ci_api(path, user = nil) |