Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2016-09-15 19:54:24 +0300
committerPatricio Cano <suprnova32@gmail.com>2016-09-15 20:21:00 +0300
commitbe09bcf074e6048aa9ba5f8dfb99754e6afbe156 (patch)
tree005f87b80bfe5e3f2320398252b18eb7601cbb8f /spec/requests
parentde24075ea5960bd7c6290c05496915e8f0ca23f2 (diff)
Refactored authentication code to make it a bit clearer, added test for wrong SSH key.
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/internal_spec.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb
index 2e1e6a11b53..46e8e6f1169 100644
--- a/spec/requests/api/internal_spec.rb
+++ b/spec/requests/api/internal_spec.rb
@@ -107,7 +107,7 @@ describe API::API, api: true do
context 'user key' do
it 'returns the correct information about the key' do
- lfs_auth(key, project)
+ lfs_auth(key.id, project)
expect(response).to have_http_status(200)
expect(json_response['username']).to eq(user.username)
@@ -115,13 +115,19 @@ describe API::API, api: true do
expect(json_response['repository_http_path']).to eq(project.http_url_to_repo)
end
+
+ it 'returns a 404 when the wrong key is provided' do
+ lfs_auth(nil, project)
+
+ expect(response).to have_http_status(404)
+ end
end
context 'deploy key' do
let(:key) { create(:deploy_key) }
it 'returns the correct information about the key' do
- lfs_auth(key, project)
+ lfs_auth(key.id, project)
expect(response).to have_http_status(200)
expect(json_response['username']).to eq("lfs+deploy-key-#{key.id}")
@@ -421,10 +427,10 @@ describe API::API, api: true do
)
end
- def lfs_auth(key, project)
+ def lfs_auth(key_id, project)
post(
api("/internal/lfs_authenticate"),
- key_id: key.id,
+ key_id: key_id,
secret_token: secret_token,
project: project.path_with_namespace
)