|
|
@ -84,6 +84,27 @@ RSpec.describe Exports::OrganisationExportService do |
|
|
|
it "returns the list with correct archive" do |
|
|
|
it "returns the list with correct archive" do |
|
|
|
expect(export_service.export_xml_organisations).to eq({ expected_zip_filename.gsub(".zip", "") => start_time }) |
|
|
|
expect(export_service.export_xml_organisations).to eq({ expected_zip_filename.gsub(".zip", "") => start_time }) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "and the organisation is merged" do |
|
|
|
|
|
|
|
let(:expected_content) { replace_entity_ids(organisation, xml_export_file.read) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
organisation.update!(merge_date: Time.zone.yesterday) |
|
|
|
|
|
|
|
expected_content.sub!("<active>true</active>", "<active>false</active>") |
|
|
|
|
|
|
|
expected_content.sub!("<merge_date/>", "<merge_date>#{organisation.merge_date.iso8601}</merge_date>") |
|
|
|
|
|
|
|
expected_content.sub!("<status>active</status>", "<status>merged</status>") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "generates an XML export file with the expected content within the ZIP file" do |
|
|
|
|
|
|
|
expect(storage_service).to receive(:write_file).with(expected_zip_filename, any_args) do |_, content| |
|
|
|
|
|
|
|
entry = Zip::File.open_buffer(content).find_entry(expected_data_filename) |
|
|
|
|
|
|
|
expect(entry).not_to be_nil |
|
|
|
|
|
|
|
expect(entry.get_input_stream.read).to eq(expected_content) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export_service.export_xml_organisations |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "and multiple organisations are available for export" do |
|
|
|
context "and multiple organisations are available for export" do |
|
|
|