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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-25 18:10:33 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-25 18:10:33 +0300
commita8c1bc6f757ecacbc3481e52a3f4cefb6c6db5fd (patch)
tree7ba85d57835274f11674c33155e68b6af33f2687 /spec/requests/api/lint_spec.rb
parent76ef00aac974a463243dcda6f692b17ff5d439bc (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/lint_spec.rb')
-rw-r--r--spec/requests/api/lint_spec.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/requests/api/lint_spec.rb b/spec/requests/api/lint_spec.rb
index f26236e0253..57aa0f36192 100644
--- a/spec/requests/api/lint_spec.rb
+++ b/spec/requests/api/lint_spec.rb
@@ -27,9 +27,10 @@ RSpec.describe API::Lint do
end
end
- context 'when signup settings are enabled' do
+ context 'when signup is enabled and not limited' do
before do
Gitlab::CurrentSettings.signup_enabled = true
+ stub_application_setting(domain_allowlist: [], email_restrictions_enabled: false, require_admin_approval_after_user_signup: false)
end
context 'when unauthenticated' do
@@ -50,6 +51,31 @@ RSpec.describe API::Lint do
end
end
+ context 'when limited signup is enabled' do
+ before do
+ stub_application_setting(domain_allowlist: ['www.gitlab.com'])
+ Gitlab::CurrentSettings.signup_enabled = true
+ end
+
+ context 'when unauthenticated' do
+ it 'returns unauthorized' do
+ post api('/ci/lint'), params: { content: 'content' }
+
+ expect(response).to have_gitlab_http_status(:unauthorized)
+ end
+ end
+
+ context 'when authenticated' do
+ let_it_be(:api_user) { create(:user) }
+
+ it 'returns authentication success' do
+ post api('/ci/lint', api_user), params: { content: 'content' }
+
+ expect(response).to have_gitlab_http_status(:ok)
+ end
+ end
+ end
+
context 'when authenticated' do
let_it_be(:api_user) { create(:user) }