2017-05-02 03:29:39 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Projects::DeployKeysController, '(JavaScript fixtures)', type: :controller do
|
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
|
|
|
|
let(:admin) { create(:admin) }
|
|
|
|
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
|
|
|
|
let(:project) { create(:project_empty_repo, namespace: namespace, path: 'todos-project') }
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project2) { create(:project, :internal)}
|
2018-05-07 14:21:34 -04:00
|
|
|
let(:project3) { create(:project, :internal)}
|
|
|
|
let(:project4) { create(:project, :internal)}
|
2017-05-02 03:29:39 -04:00
|
|
|
|
|
|
|
before(:all) do
|
|
|
|
clean_frontend_fixtures('deploy_keys/')
|
|
|
|
end
|
|
|
|
|
2017-08-10 18:31:42 -04:00
|
|
|
before do
|
2017-05-02 03:29:39 -04:00
|
|
|
sign_in(admin)
|
|
|
|
end
|
2017-08-22 19:19:35 -04:00
|
|
|
|
|
|
|
after do
|
|
|
|
remove_repository(project)
|
|
|
|
end
|
2017-05-02 03:29:39 -04:00
|
|
|
|
|
|
|
render_views
|
|
|
|
|
|
|
|
it 'deploy_keys/keys.json' do |example|
|
|
|
|
create(:deploy_key, public: true)
|
|
|
|
project_key = create(:deploy_key, key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCdMHEHyhRjbhEZVddFn6lTWdgEy5Q6Bz4nwGB76xWZI5YT/1WJOMEW+sL5zYd31kk7sd3FJ5L9ft8zWMWrr/iWXQikC2cqZK24H1xy+ZUmrRuJD4qGAaIVoyyzBL+avL+lF8J5lg6YSw8gwJY/lX64/vnJHUlWw2n5BF8IFOWhiw== dummy@gitlab.com')
|
|
|
|
internal_key = create(:deploy_key, key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDNd/UJWhPrpb+b/G5oL109y57yKuCxE+WUGJGYaj7WQKsYRJmLYh1mgjrl+KVyfsWpq4ylOxIfFSnN9xBBFN8mlb0Fma5DC7YsSsibJr3MZ19ZNBprwNcdogET7aW9I0In7Wu5f2KqI6e5W/spJHCy4JVxzVMUvk6Myab0LnJ2iQ== dummy@gitlab.com')
|
|
|
|
create(:deploy_keys_project, project: project, deploy_key: project_key)
|
|
|
|
create(:deploy_keys_project, project: project2, deploy_key: internal_key)
|
2018-05-07 14:21:34 -04:00
|
|
|
create(:deploy_keys_project, project: project3, deploy_key: project_key)
|
|
|
|
create(:deploy_keys_project, project: project4, deploy_key: project_key)
|
2017-05-02 03:29:39 -04:00
|
|
|
|
2018-12-19 14:50:20 -05:00
|
|
|
get :index, params: {
|
2017-05-02 03:29:39 -04:00
|
|
|
namespace_id: project.namespace.to_param,
|
2018-12-19 14:50:20 -05:00
|
|
|
project_id: project
|
|
|
|
}, format: :json
|
2017-05-02 03:29:39 -04:00
|
|
|
|
|
|
|
expect(response).to be_success
|
|
|
|
store_frontend_fixture(response, example.description)
|
|
|
|
end
|
|
|
|
end
|