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>2019-09-20 15:11:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-20 15:11:29 +0300
commit7b384a1f3d2608898318e67d11eea2914889ae81 (patch)
treeaf33e77d13b18a96156c69616cb09a3a4f7697c6 /spec/requests
parentd46287cc16ba244720c6d5c00491944336972988 (diff)
Add latest changes from gitlab-org/gitlab@12-3-stable
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/commits_spec.rb12
-rw-r--r--spec/requests/api/project_container_repositories_spec.rb36
-rw-r--r--spec/requests/api/project_export_spec.rb2
-rw-r--r--spec/requests/api/project_import_spec.rb47
4 files changed, 10 insertions, 87 deletions
diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb
index 90ff1d12bf1..5e6ff40e8cf 100644
--- a/spec/requests/api/commits_spec.rb
+++ b/spec/requests/api/commits_spec.rb
@@ -169,18 +169,6 @@ describe API::Commits do
end
end
- context 'first_parent optional parameter' do
- it 'returns all first_parent commits' do
- commit_count = project.repository.count_commits(ref: SeedRepo::Commit::ID, first_parent: true)
-
- get api("/projects/#{project_id}/repository/commits", user), params: { ref_name: SeedRepo::Commit::ID, first_parent: 'true' }
-
- expect(response).to include_pagination_headers
- expect(commit_count).to eq(12)
- expect(response.headers['X-Total']).to eq(commit_count.to_s)
- end
- end
-
context 'with_stats optional parameter' do
let(:project) { create(:project, :public, :repository) }
diff --git a/spec/requests/api/project_container_repositories_spec.rb b/spec/requests/api/project_container_repositories_spec.rb
index 3ac7ff7656b..f1dc4e6f0b2 100644
--- a/spec/requests/api/project_container_repositories_spec.rb
+++ b/spec/requests/api/project_container_repositories_spec.rb
@@ -150,7 +150,7 @@ describe API::ProjectContainerRepositories do
expect(response).to have_gitlab_http_status(:accepted)
end
- context 'called multiple times in one hour', :clean_gitlab_redis_shared_state do
+ context 'called multiple times in one hour' do
it 'returns 400 with an error message' do
stub_exclusive_lease_taken(lease_key, timeout: 1.hour)
subject
@@ -202,8 +202,6 @@ describe API::ProjectContainerRepositories do
end
describe 'DELETE /projects/:id/registry/repositories/:repository_id/tags/:tag_name' do
- let(:service) { double('service') }
-
subject { delete api("/projects/#{project.id}/registry/repositories/#{root_repository.id}/tags/rootA", api_user) }
it_behaves_like 'rejected container repository access', :reporter, :forbidden
@@ -212,34 +210,18 @@ describe API::ProjectContainerRepositories do
context 'for developer' do
let(:api_user) { developer }
- context 'when there are multiple tags' do
- before do
- stub_container_registry_tags(repository: root_repository.path, tags: %w(rootA rootB), with_manifest: true)
- end
-
- it 'properly removes tag' do
- expect(service).to receive(:execute).with(root_repository) { { status: :success } }
- expect(Projects::ContainerRepository::DeleteTagsService).to receive(:new).with(root_repository.project, api_user, tags: %w[rootA]) { service }
-
- subject
-
- expect(response).to have_gitlab_http_status(:ok)
- end
+ before do
+ stub_container_registry_tags(repository: root_repository.path, tags: %w(rootA), with_manifest: true)
end
- context 'when there\'s only one tag' do
- before do
- stub_container_registry_tags(repository: root_repository.path, tags: %w(rootA), with_manifest: true)
- end
-
- it 'properly removes tag' do
- expect(service).to receive(:execute).with(root_repository) { { status: :success } }
- expect(Projects::ContainerRepository::DeleteTagsService).to receive(:new).with(root_repository.project, api_user, tags: %w[rootA]) { service }
+ it 'properly removes tag' do
+ expect_any_instance_of(ContainerRegistry::Client)
+ .to receive(:delete_repository_tag).with(root_repository.path,
+ 'sha256:4c8e63ca4cb663ce6c688cb06f1c372b088dac5b6d7ad7d49cd620d85cf72a15')
- subject
+ subject
- expect(response).to have_gitlab_http_status(:ok)
- end
+ expect(response).to have_gitlab_http_status(:ok)
end
end
end
diff --git a/spec/requests/api/project_export_spec.rb b/spec/requests/api/project_export_spec.rb
index 7de8935097a..1d2f81a397d 100644
--- a/spec/requests/api/project_export_spec.rb
+++ b/spec/requests/api/project_export_spec.rb
@@ -30,7 +30,7 @@ describe API::ProjectExport do
FileUtils.mkdir_p File.join(project_started.export_path, 'securerandom-hex')
# simulate in after export action
- FileUtils.touch File.join(project_after_export.import_export_shared.lock_files_path, SecureRandom.hex)
+ FileUtils.touch Gitlab::ImportExport::AfterExportStrategies::BaseAfterExportStrategy.lock_file_path(project_after_export)
end
after do
diff --git a/spec/requests/api/project_import_spec.rb b/spec/requests/api/project_import_spec.rb
index d2b1fb063b8..594b42bb6c0 100644
--- a/spec/requests/api/project_import_spec.rb
+++ b/spec/requests/api/project_import_spec.rb
@@ -33,53 +33,6 @@ describe API::ProjectImport do
expect(response).to have_gitlab_http_status(201)
end
- context 'when a name is explicitly set' do
- let(:expected_name) { 'test project import' }
-
- it 'schedules an import using a namespace and a different name' do
- stub_import(namespace)
-
- post api('/projects/import', user), params: { path: 'test-import', file: fixture_file_upload(file), namespace: namespace.id, name: expected_name }
-
- expect(response).to have_gitlab_http_status(201)
- end
-
- it 'schedules an import using the namespace path and a different name' do
- stub_import(namespace)
-
- post api('/projects/import', user), params: { path: 'test-import', file: fixture_file_upload(file), namespace: namespace.full_path, name: expected_name }
-
- expect(response).to have_gitlab_http_status(201)
- end
-
- it 'sets name correctly' do
- stub_import(namespace)
-
- post api('/projects/import', user), params: { path: 'test-import', file: fixture_file_upload(file), namespace: namespace.full_path, name: expected_name }
-
- project = Project.find(json_response['id'])
- expect(project.name).to eq(expected_name)
- end
-
- it 'sets name correctly with an overwrite' do
- stub_import(namespace)
-
- post api('/projects/import', user), params: { path: 'test-import', file: fixture_file_upload(file), namespace: namespace.full_path, name: 'new project name', overwrite: true }
-
- project = Project.find(json_response['id'])
- expect(project.name).to eq('new project name')
- end
-
- it 'schedules an import using the path and name explicitly set to nil' do
- stub_import(namespace)
-
- post api('/projects/import', user), params: { path: 'test-import', file: fixture_file_upload(file), namespace: namespace.full_path, name: nil }
-
- project = Project.find(json_response['id'])
- expect(project.name).to eq('test-import')
- end
- end
-
it 'schedules an import at the user namespace level' do
stub_import(user.namespace)