summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2018-02-12 12:40:55 +0100
committerJames Lopez <james@jameslopez.es>2018-02-13 15:25:47 +0100
commit848f49801d2c45227c525fb5ecdf8b71e7711ded (patch)
tree9ab7e1387d74eb276423ec96490bcff0f2cd62eb
parentde3edb7178bd7df2f72ef403e57bfdf4e6f732df (diff)
downloadgitlab-ce-848f49801d2c45227c525fb5ecdf8b71e7711ded.tar.gz
add entity and update spec
-rw-r--r--lib/api/api.rb1
-rw-r--r--lib/api/entities.rb5
-rw-r--r--spec/requests/api/project_import_spec.rb4
3 files changed, 8 insertions, 2 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb
index e953f3d2eca..754549f72f0 100644
--- a/lib/api/api.rb
+++ b/lib/api/api.rb
@@ -138,6 +138,7 @@ module API
mount ::API::PagesDomains
mount ::API::Pipelines
mount ::API::PipelineSchedules
+ mount ::API::ProjectImport
mount ::API::ProjectHooks
mount ::API::Projects
mount ::API::ProjectMilestones
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 7838de13c56..8fbad2b6959 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -90,6 +90,11 @@ module API
expose :created_at
end
+ class ProjectImportStatus < ProjectIdentity
+ expose :import_status
+ expose :import_error, if: :import_error
+ end
+
class BasicProjectDetails < ProjectIdentity
include ::API::ProjectsRelationBuilder
diff --git a/spec/requests/api/project_import_spec.rb b/spec/requests/api/project_import_spec.rb
index bf7bde0325a..55df2d34419 100644
--- a/spec/requests/api/project_import_spec.rb
+++ b/spec/requests/api/project_import_spec.rb
@@ -33,7 +33,7 @@ describe API::ProjectImport do
get api("/projects/#{project.id}/import", user)
expect(response).to have_gitlab_http_status(200)
- expect(json_response).to eq('import_status' => 'started')
+ expect(json_response).to include('import_status' => 'started')
end
it 'returns the import status and the error if failed' do
@@ -42,7 +42,7 @@ describe API::ProjectImport do
get api("/projects/#{project.id}/import", user)
expect(response).to have_gitlab_http_status(200)
- expect(json_response).to eq('import_status' => 'failed',
+ expect(json_response).to include('import_status' => 'failed',
'import_error' => 'error')
end
end