Browse Source

Add DPO agreements to import rake task (#431)

pull/432/head
baarkerlounger 3 years ago committed by GitHub
parent
commit
61406bd845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      lib/tasks/data_import.rake
  2. 18
      spec/lib/tasks/data_import_spec.rb

2
lib/tasks/data_import.rake

@ -12,6 +12,8 @@ namespace :core do
Imports::OrganisationImportService.new(storage_service).create_organisations(path)
when "user"
Imports::UserImportService.new(storage_service).create_users(path)
when "data-protection-confirmation"
Imports::DataProtectionConfirmationImportService.new(storage_service).create_data_protection_confirmations(path)
else
raise "Type #{type} is not supported by data_import"
end

18
spec/lib/tasks/data_import_spec.rb

@ -54,6 +54,24 @@ describe "rake core:data_import", type: :task do
end
end
context "when importing data protection confirmation data" do
let(:type) { "data-protection-confirmation" }
let(:import_service) { instance_double(Imports::DataProtectionConfirmationImportService) }
let(:fixture_path) { "spec/fixtures/softwire_imports/data_protection_confirmations" }
before do
allow(Imports::DataProtectionConfirmationImportService).to receive(:new).and_return(import_service)
end
it "creates an organisation from the given XML file" do
expect(StorageService).to receive(:new).with(paas_config_service, instance_name)
expect(Imports::DataProtectionConfirmationImportService).to receive(:new).with(storage_service)
expect(import_service).to receive(:create_data_protection_confirmations).with(fixture_path)
task.invoke(type, fixture_path)
end
end
it "raises an exception if no parameters are provided" do
expect { task.invoke }.to raise_error(/Usage/)
end

Loading…
Cancel
Save