Commit 8c3a1891 authored by mo khan's avatar mo khan Committed by Ash McKenzie

Convert approval_status to classification during update

parent 0d5c00b0
......@@ -12,7 +12,7 @@ module SoftwareLicensePolicies
return success(software_license_policy: software_license_policy) unless params[:approval_status].present?
begin
software_license_policy.update(classification: params[:approval_status])
software_license_policy.update(classification: map_from(params[:approval_status]))
RefreshLicenseComplianceChecksWorker.perform_async(project.id)
rescue ArgumentError => ex
return error(ex.message, 400)
......@@ -20,5 +20,16 @@ module SoftwareLicensePolicies
success(software_license_policy: software_license_policy)
end
private
def map_from(approval_status)
case approval_status
when 'blacklisted'
'denied'
else
approval_status
end
end
end
end
......@@ -11,13 +11,7 @@ describe SoftwareLicensePolicies::UpdateService do
end
end
let(:software_license_policy) do
create(
:software_license_policy,
software_license: create(:software_license, name: 'ExamplePL/2.1'),
classification: 'blacklisted'
)
end
let(:software_license_policy) { create(:software_license_policy, :denied) }
before do
stub_licensed_features(license_management: true)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment