From 7784048260f8da5f98cca30d4c11d0891e43e04b Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:03:34 +0000 Subject: [PATCH] Export status to CDS for orgs --- app/services/exports/organisation_export_constants.rb | 3 ++- app/services/exports/organisation_export_service.rb | 3 ++- spec/fixtures/exports/organisation.xml | 1 + spec/services/exports/organisation_export_service_spec.rb | 8 +++++--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/services/exports/organisation_export_constants.rb b/app/services/exports/organisation_export_constants.rb index 3a1c5fb48..6c78a55db 100644 --- a/app/services/exports/organisation_export_constants.rb +++ b/app/services/exports/organisation_export_constants.rb @@ -22,6 +22,7 @@ module Exports::OrganisationExportConstants "dsa_signed_at", "dpo_email", "profit_status", - "group" + "group", + "status" ] end diff --git a/app/services/exports/organisation_export_service.rb b/app/services/exports/organisation_export_service.rb index fb034ac03..8ceba93a9 100644 --- a/app/services/exports/organisation_export_service.rb +++ b/app/services/exports/organisation_export_service.rb @@ -65,7 +65,8 @@ module Exports attribute_hash["available_from"] = organisation.available_from&.iso8601 attribute_hash["profit_status"] = nil # will need update when we add the field to the org attribute_hash["group"] = nil # will need update when we add the field to the org - attribute_hash["active"] = organisation.status == :active + attribute_hash["status"] = organisation.status + attribute_hash["active"] = attribute_hash["status"] == :active attribute_hash end diff --git a/spec/fixtures/exports/organisation.xml b/spec/fixtures/exports/organisation.xml index 70c699915..f70ac2b7d 100644 --- a/spec/fixtures/exports/organisation.xml +++ b/spec/fixtures/exports/organisation.xml @@ -22,5 +22,6 @@ {dpo_email} + active diff --git a/spec/services/exports/organisation_export_service_spec.rb b/spec/services/exports/organisation_export_service_spec.rb index d23d16e10..6ef66161a 100644 --- a/spec/services/exports/organisation_export_service_spec.rb +++ b/spec/services/exports/organisation_export_service_spec.rb @@ -86,14 +86,16 @@ RSpec.describe Exports::OrganisationExportService do 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!("true", "false") + expected_content.sub!("", "#{organisation.merge_date.iso8601}") + expected_content.sub!("active", "merged") end it "generates an XML export file with the expected content within the ZIP file" do - expected_content = replace_entity_ids(organisation, xml_export_file.read) - expected_content.sub!("true", "false") - expected_content.sub!("", "#{organisation.merge_date.iso8601}") 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