summaryrefslogtreecommitdiff
path: root/spec/requests/api/internal/base_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/internal/base_spec.rb')
-rw-r--r--spec/requests/api/internal/base_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/requests/api/internal/base_spec.rb b/spec/requests/api/internal/base_spec.rb
index ab5f09305ce..6fe77727702 100644
--- a/spec/requests/api/internal/base_spec.rb
+++ b/spec/requests/api/internal/base_spec.rb
@@ -253,6 +253,7 @@ RSpec.describe API::Internal::Base do
describe "POST /internal/lfs_authenticate" do
before do
+ stub_lfs_setting(enabled: true)
project.add_developer(user)
end
@@ -293,6 +294,33 @@ RSpec.describe API::Internal::Base do
expect(response).to have_gitlab_http_status(:not_found)
end
+
+ it 'returns a 404 when LFS is disabled on the project' do
+ project.update!(lfs_enabled: false)
+ lfs_auth_user(user.id, project)
+
+ expect(response).to have_gitlab_http_status(:not_found)
+ end
+
+ context 'other repository types' do
+ it 'returns the correct information for a project wiki' do
+ wiki = create(:project_wiki, project: project)
+ lfs_auth_user(user.id, wiki)
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response['username']).to eq(user.username)
+ expect(json_response['repository_http_path']).to eq(wiki.http_url_to_repo)
+ expect(json_response['expires_in']).to eq(Gitlab::LfsToken::DEFAULT_EXPIRE_TIME)
+ expect(Gitlab::LfsToken.new(user).token_valid?(json_response['lfs_token'])).to be_truthy
+ end
+
+ it 'returns a 404 when the container does not support LFS' do
+ snippet = create(:project_snippet)
+ lfs_auth_user(user.id, snippet)
+
+ expect(response).to have_gitlab_http_status(:not_found)
+ end
+ end
end
context 'deploy key' do