debian-mirror-gitlab/spec/routing/import_routing_spec.rb

171 lines
9.2 KiB
Ruby
Raw Normal View History

2019-12-26 22:10:19 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
# Shared examples for a resource inside a Project
#
# By default it tests all the default REST actions: index, create, new, edit,
# show, update, and destroy. You can remove actions by customizing the
# `actions` variable.
#
# It also expects a `controller` variable to be available which defines both
# the path to the resource as well as the controller name.
#
# Examples
#
# # Default behavior
# it_behaves_like 'RESTful project resources' do
# let(:controller) { 'issues' }
# end
#
# # Customizing actions
# it_behaves_like 'RESTful project resources' do
# let(:actions) { [:index] }
# let(:controller) { 'issues' }
# end
2020-07-28 23:09:34 +05:30
RSpec.shared_examples 'importer routing' do
2017-08-17 22:00:37 +05:30
let(:except_actions) { [] }
2019-07-07 11:18:12 +05:30
let(:is_realtime) { false }
before do
except_actions.push(is_realtime ? :jobs : :realtime_changes)
end
2017-08-17 22:00:37 +05:30
it 'to #create' do
expect(post("/import/#{provider}")).to route_to("import/#{provider}#create") unless except_actions.include?(:create)
end
it 'to #new' do
expect(get("/import/#{provider}/new")).to route_to("import/#{provider}#new") unless except_actions.include?(:new)
end
it 'to #status' do
expect(get("/import/#{provider}/status")).to route_to("import/#{provider}#status") unless except_actions.include?(:status)
end
it 'to #callback' do
expect(get("/import/#{provider}/callback")).to route_to("import/#{provider}#callback") unless except_actions.include?(:callback)
end
it 'to #jobs' do
expect(get("/import/#{provider}/jobs")).to route_to("import/#{provider}#jobs") unless except_actions.include?(:jobs)
end
2019-07-07 11:18:12 +05:30
it 'to #realtime_changes' do
expect(get("/import/#{provider}/realtime_changes")).to route_to("import/#{provider}#realtime_changes") unless except_actions.include?(:realtime_changes)
end
2017-08-17 22:00:37 +05:30
end
# personal_access_token_import_github POST /import/github/personal_access_token(.:format) import/github#personal_access_token
# status_import_github GET /import/github/status(.:format) import/github#status
# callback_import_github GET /import/github/callback(.:format) import/github#callback
2019-07-07 11:18:12 +05:30
# realtime_changes_import_github GET /import/github/realtime_changes(.:format) import/github#jobs
2017-08-17 22:00:37 +05:30
# import_github POST /import/github(.:format) import/github#create
# new_import_github GET /import/github/new(.:format) import/github#new
2023-07-09 08:55:56 +05:30
RSpec.describe Import::GithubController, 'routing', feature_category: :importers do
2017-08-17 22:00:37 +05:30
it_behaves_like 'importer routing' do
let(:provider) { 'github' }
2019-07-07 11:18:12 +05:30
let(:is_realtime) { true }
2017-08-17 22:00:37 +05:30
end
it 'to #personal_access_token' do
expect(post('/import/github/personal_access_token')).to route_to('import/github#personal_access_token')
end
2023-04-23 21:23:45 +05:30
it 'to #cancel_all' do
expect(post('/import/github/cancel_all')).to route_to('import/github#cancel_all')
end
2023-05-27 22:25:52 +05:30
it 'to #counts' do
expect(get('/import/github/counts')).to route_to('import/github#counts')
end
2017-08-17 22:00:37 +05:30
end
# personal_access_token_import_gitea POST /import/gitea/personal_access_token(.:format) import/gitea#personal_access_token
# status_import_gitea GET /import/gitea/status(.:format) import/gitea#status
2019-07-07 11:18:12 +05:30
# realtime_changes_import_gitea GET /import/gitea/realtime_changes(.:format) import/gitea#jobs
2017-08-17 22:00:37 +05:30
# import_gitea POST /import/gitea(.:format) import/gitea#create
# new_import_gitea GET /import/gitea/new(.:format) import/gitea#new
2023-07-09 08:55:56 +05:30
RSpec.describe Import::GiteaController, 'routing', feature_category: :importers do
2017-08-17 22:00:37 +05:30
it_behaves_like 'importer routing' do
let(:except_actions) { [:callback] }
let(:provider) { 'gitea' }
2019-07-07 11:18:12 +05:30
let(:is_realtime) { true }
2017-08-17 22:00:37 +05:30
end
it 'to #personal_access_token' do
expect(post('/import/gitea/personal_access_token')).to route_to('import/gitea#personal_access_token')
end
end
2020-07-28 23:09:34 +05:30
# status_import_bitbucket GET /import/bitbucket/status(.:format) import/bitbucket#status
# callback_import_bitbucket GET /import/bitbucket/callback(.:format) import/bitbucket#callback
# realtime_changes_import_bitbucket GET /import/bitbucket/realtime_changes(.:format) import/bitbucket#realtime_changes
# import_bitbucket POST /import/bitbucket(.:format) import/bitbucket#create
2023-07-09 08:55:56 +05:30
RSpec.describe Import::BitbucketController, 'routing', feature_category: :importers do
2017-08-17 22:00:37 +05:30
it_behaves_like 'importer routing' do
let(:except_actions) { [:new] }
let(:provider) { 'bitbucket' }
2020-07-28 23:09:34 +05:30
let(:is_realtime) { true }
end
end
# status_import_bitbucket_server GET /import/bitbucket_server/status(.:format) import/bitbucket_server#status
# callback_import_bitbucket_server GET /import/bitbucket_server/callback(.:format) import/bitbucket_server#callback
# realtime_changes_import_bitbucket_server GET /import/bitbucket_server/realtime_changes(.:format) import/bitbucket_server#realtime_changes
# new_import_bitbucket_server GET /import/bitbucket_server/new(.:format) import/bitbucket_server#new
# import_bitbucket_server POST /import/bitbucket_server(.:format) import/bitbucket_server#create
2023-07-09 08:55:56 +05:30
RSpec.describe Import::BitbucketServerController, 'routing', feature_category: :importers do
2020-07-28 23:09:34 +05:30
it_behaves_like 'importer routing' do
let(:provider) { 'bitbucket_server' }
let(:is_realtime) { true }
2017-08-17 22:00:37 +05:30
end
end
2020-07-28 23:09:34 +05:30
# status_import_fogbugz GET /import/fogbugz/status(.:format) import/fogbugz#status
# callback_import_fogbugz POST /import/fogbugz/callback(.:format) import/fogbugz#callback
# realtime_changes_import_fogbugz GET /import/fogbugz/realtime_changes(.:format) import/fogbugz#realtime_changes
# new_user_map_import_fogbugz GET /import/fogbugz/user_map(.:format) import/fogbugz#new_user_map
# create_user_map_import_fogbugz POST /import/fogbugz/user_map(.:format) import/fogbugz#create_user_map
# import_fogbugz POST /import/fogbugz(.:format) import/fogbugz#create
# new_import_fogbugz GET /import/fogbugz/new(.:format) import/fogbugz#new
2023-07-09 08:55:56 +05:30
RSpec.describe Import::FogbugzController, 'routing', feature_category: :importers do
2017-08-17 22:00:37 +05:30
it_behaves_like 'importer routing' do
let(:except_actions) { [:callback] }
let(:provider) { 'fogbugz' }
2020-07-28 23:09:34 +05:30
let(:is_realtime) { true }
2017-08-17 22:00:37 +05:30
end
it 'to #callback' do
expect(post("/import/fogbugz/callback")).to route_to("import/fogbugz#callback")
end
it 'to #new_user_map' do
expect(get('/import/fogbugz/user_map')).to route_to('import/fogbugz#new_user_map')
end
it 'to #create_user_map' do
expect(post('/import/fogbugz/user_map')).to route_to('import/fogbugz#create_user_map')
end
end
# import_gitlab_project POST /import/gitlab_project(.:format) import/gitlab_projects#create
# POST /import/gitlab_project(.:format) import/gitlab_projects#create
# new_import_gitlab_project GET /import/gitlab_project/new(.:format) import/gitlab_projects#new
2023-07-09 08:55:56 +05:30
RSpec.describe Import::GitlabProjectsController, 'routing', feature_category: :importers do
2017-08-17 22:00:37 +05:30
it 'to #create' do
expect(post('/import/gitlab_project')).to route_to('import/gitlab_projects#create')
end
it 'to #new' do
expect(get('/import/gitlab_project/new')).to route_to('import/gitlab_projects#new')
end
end
2019-09-04 21:01:54 +05:30
2022-11-25 23:54:43 +05:30
# status_import_github_group GET /import/github_group/status(.:format) import/github_groups#status
2023-07-09 08:55:56 +05:30
RSpec.describe Import::GithubGroupsController, 'routing', feature_category: :importers do
2022-11-25 23:54:43 +05:30
it 'to #status' do
expect(get('/import/github_group/status')).to route_to('import/github_groups#status')
end
end