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:
Diffstat (limited to 'spec/requests/api/import_github_spec.rb')
-rw-r--r--spec/requests/api/import_github_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/requests/api/import_github_spec.rb b/spec/requests/api/import_github_spec.rb
index 015a09d41ab..4f95295c14d 100644
--- a/spec/requests/api/import_github_spec.rb
+++ b/spec/requests/api/import_github_spec.rb
@@ -89,6 +89,18 @@ RSpec.describe API::ImportGithub do
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
+
+ context 'when unauthenticated user' do
+ it 'returns 403 response' do
+ post api("/import/github"), params: {
+ target_namespace: user.namespace_path,
+ personal_access_token: token,
+ repo_id: non_existing_record_id
+ }
+
+ expect(response).to have_gitlab_http_status(:unauthorized)
+ end
+ end
end
describe "POST /import/github/cancel" do
@@ -127,5 +139,15 @@ RSpec.describe API::ImportGithub do
expect(json_response['message']).to eq('The import cannot be canceled because it is finished')
end
end
+
+ context 'when unauthenticated user' do
+ it 'returns 403 response' do
+ post api("/import/github/cancel"), params: {
+ project_id: project.id
+ }
+
+ expect(response).to have_gitlab_http_status(:unauthorized)
+ end
+ end
end
end