aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/api/v1
diff options
context:
space:
mode:
authorXinhui2017-08-23 14:28:22 +0200
committerXinhui2017-08-23 14:28:22 +0200
commit1d496326ca9177bd1b9b5202eaa5f6137bfd7fa6 (patch)
treef40452096e9aa7a96e99bc71534a4a1419cfccf8 /spec/controllers/api/v1
parent6ef942b93eaa0a1d0d6203a3e984f95c751e9ea9 (diff)
downloadchouette-core-1d496326ca9177bd1b9b5202eaa5f6137bfd7fa6.tar.bz2
API - WorkbenchImport #create action
Refs #4280
Diffstat (limited to 'spec/controllers/api/v1')
-rw-r--r--spec/controllers/api/v1/imports_controller_spec.rb11
-rw-r--r--spec/controllers/api/v1/workbenches_controller_spec.rb2
2 files changed, 13 insertions, 0 deletions
diff --git a/spec/controllers/api/v1/imports_controller_spec.rb b/spec/controllers/api/v1/imports_controller_spec.rb
index 52fbf8e9b..f9593df99 100644
--- a/spec/controllers/api/v1/imports_controller_spec.rb
+++ b/spec/controllers/api/v1/imports_controller_spec.rb
@@ -4,6 +4,8 @@ RSpec.describe Api::V1::ImportsController, type: :controller do
let(:workbench) { create :workbench, organisation: organisation }
context 'unauthenticated' do
+ include_context 'iboo wrong authorisation api user'
+
describe 'GET #index' do
it 'should not be successful' do
get :index, workbench_id: workbench.id
@@ -21,5 +23,14 @@ RSpec.describe Api::V1::ImportsController, type: :controller do
expect(response).to be_success
end
end
+
+ describe 'POST #create' do
+ let(:file) { fixture_file_upload('multiple_references_import.zip') }
+
+ it 'should be successful' do
+ post :create, workbench_id: workbench.id, workbench_import: {file: file, creator: 'test'}, format: :json
+ expect(response).to be_success
+ end
+ end
end
end
diff --git a/spec/controllers/api/v1/workbenches_controller_spec.rb b/spec/controllers/api/v1/workbenches_controller_spec.rb
index dc05c3926..7780da142 100644
--- a/spec/controllers/api/v1/workbenches_controller_spec.rb
+++ b/spec/controllers/api/v1/workbenches_controller_spec.rb
@@ -2,6 +2,8 @@ require 'rails_helper'
RSpec.describe Api::V1::WorkbenchesController, type: :controller do
context 'unauthenticated' do
+ include_context 'iboo wrong authorisation api user'
+
describe 'GET #index' do
it 'should not be successful' do
get :index