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-02-01 12:02:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-01 12:02:58 +0300
commit23330db102f66781cc9a22cd006433cfcbd13863 (patch)
tree7c1630c6373a1c4d156eeb7f8bc4010c9a280d11 /spec/routing
parent8d628223c41aabc9d42af95cce1193becffa1b0f (diff)
Add latest changes from gitlab-org/security/gitlab@13-8-stable-ee
Diffstat (limited to 'spec/routing')
-rw-r--r--spec/routing/git_http_routing_spec.rb21
-rw-r--r--spec/routing/project_routing_spec.rb69
2 files changed, 90 insertions, 0 deletions
diff --git a/spec/routing/git_http_routing_spec.rb b/spec/routing/git_http_routing_spec.rb
index e3cc1440a9e..79d392e4132 100644
--- a/spec/routing/git_http_routing_spec.rb
+++ b/spec/routing/git_http_routing_spec.rb
@@ -7,6 +7,10 @@ RSpec.describe 'git_http routing' do
it_behaves_like 'git repository routes' do
let(:path) { '/gitlab-org/gitlab-test.git' }
end
+
+ it_behaves_like 'git repository routes with fallback for git-upload-pack' do
+ let(:path) { '/gitlab-org/gitlab-test.git' }
+ end
end
describe 'wiki repositories' do
@@ -14,6 +18,7 @@ RSpec.describe 'git_http routing' do
let(:path) { '/gitlab-org/gitlab-test.wiki.git' }
it_behaves_like 'git repository routes'
+ it_behaves_like 'git repository routes with fallback for git-upload-pack'
describe 'redirects', type: :request do
let(:web_path) { '/gitlab-org/gitlab-test/-/wikis' }
@@ -37,12 +42,20 @@ RSpec.describe 'git_http routing' do
it_behaves_like 'git repository routes' do
let(:path) { '/gitlab-org.wiki.git' }
end
+
+ it_behaves_like 'git repository routes with fallback for git-upload-pack' do
+ let(:path) { '/gitlab-org.wiki.git' }
+ end
end
context 'in child group' do
it_behaves_like 'git repository routes' do
let(:path) { '/gitlab-org/child.wiki.git' }
end
+
+ it_behaves_like 'git repository routes with fallback for git-upload-pack' do
+ let(:path) { '/gitlab-org/child.wiki.git' }
+ end
end
end
@@ -51,12 +64,20 @@ RSpec.describe 'git_http routing' do
it_behaves_like 'git repository routes' do
let(:path) { '/snippets/123.git' }
end
+
+ it_behaves_like 'git repository routes without fallback' do
+ let(:path) { '/snippets/123.git' }
+ end
end
context 'project snippet' do
it_behaves_like 'git repository routes' do
let(:path) { '/gitlab-org/gitlab-test/snippets/123.git' }
end
+
+ it_behaves_like 'git repository routes with fallback' do
+ let(:path) { '/gitlab-org/gitlab-test/snippets/123.git' }
+ end
end
end
end
diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb
index 29e5c1b4bae..f7ed8d7d5dc 100644
--- a/spec/routing/project_routing_spec.rb
+++ b/spec/routing/project_routing_spec.rb
@@ -876,4 +876,73 @@ RSpec.describe 'project routing' do
)
end
end
+
+ context 'with a non-existent project' do
+ it 'routes to 404 with get request' do
+ expect(get: "/gitlab/not_exist").to route_to(
+ 'application#route_not_found',
+ unmatched_route: 'gitlab/not_exist'
+ )
+ end
+
+ it 'routes to 404 with delete request' do
+ expect(delete: "/gitlab/not_exist").to route_to(
+ 'application#route_not_found',
+ namespace_id: 'gitlab',
+ project_id: 'not_exist'
+ )
+ end
+
+ it 'routes to 404 with post request' do
+ expect(post: "/gitlab/not_exist").to route_to(
+ 'application#route_not_found',
+ namespace_id: 'gitlab',
+ project_id: 'not_exist'
+ )
+ end
+
+ it 'routes to 404 with put request' do
+ expect(put: "/gitlab/not_exist").to route_to(
+ 'application#route_not_found',
+ namespace_id: 'gitlab',
+ project_id: 'not_exist'
+ )
+ end
+
+ context 'with route to some action' do
+ it 'routes to 404 with get request to' do
+ expect(get: "/gitlab/not_exist/some_action").to route_to(
+ 'application#route_not_found',
+ unmatched_route: 'gitlab/not_exist/some_action'
+ )
+ end
+
+ it 'routes to 404 with delete request' do
+ expect(delete: "/gitlab/not_exist/some_action").to route_to(
+ 'application#route_not_found',
+ namespace_id: 'gitlab',
+ project_id: 'not_exist',
+ all: 'some_action'
+ )
+ end
+
+ it 'routes to 404 with post request' do
+ expect(post: "/gitlab/not_exist/some_action").to route_to(
+ 'application#route_not_found',
+ namespace_id: 'gitlab',
+ project_id: 'not_exist',
+ all: 'some_action'
+ )
+ end
+
+ it 'routes to 404 with put request' do
+ expect(put: "/gitlab/not_exist/some_action").to route_to(
+ 'application#route_not_found',
+ namespace_id: 'gitlab',
+ project_id: 'not_exist',
+ all: 'some_action'
+ )
+ end
+ end
+ end
end