diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-05-16 02:13:36 +0300 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-06-05 15:32:26 +0300 |
commit | ff8a053d5ddf154cd52c3e21ac24619dbbee0dc7 (patch) | |
tree | 799e225f3cf02de76aa0d9c3fa66766e4e7b05c5 /spec/support | |
parent | c34107608ecc5c36e80a748eb4c9b88d2b1157cf (diff) |
Fix Git over HTTP spec
* The spec has 7 failures at this point
* Specify rendered error messages
* Render the GitAccess message rather than “Access denied”
* Render the Not Found message provided by GitAccess, instead of a custom one
* Expect GitAccess to check the config for whether Git-over-HTTP pull or push is disabled, rather than doing it in the controller
* Add more thorough testing for authentication
* Dried up a lot of tests
* Fixed some broken tests
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/git_http_helpers.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/support/git_http_helpers.rb b/spec/support/git_http_helpers.rb index 46b686fce94..d3d51560a9d 100644 --- a/spec/support/git_http_helpers.rb +++ b/spec/support/git_http_helpers.rb @@ -35,9 +35,14 @@ module GitHttpHelpers yield response end + def download_or_upload(*args, &block) + download(*args, &block) + upload(*args, &block) + end + def auth_env(user, password, spnego_request_token) env = workhorse_internal_api_request_header - if user && password + if user env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(user, password) elsif spnego_request_token env['HTTP_AUTHORIZATION'] = "Negotiate #{::Base64.strict_encode64('opaque_request_token')}" @@ -45,4 +50,16 @@ module GitHttpHelpers env end + + def git_access_error(error_key) + Gitlab::GitAccess::ERROR_MESSAGES[error_key] + end + + def git_access_wiki_error(error_key) + Gitlab::GitAccessWiki::ERROR_MESSAGES[error_key] + end + + def change_access_error(error_key) + Gitlab::Checks::ChangeAccess::ERROR_MESSAGES[error_key] + end end |