Skip to content

Commit

Permalink
Merge pull request #1787 from unboxed/make-ownership-certificate-opti…
Browse files Browse the repository at this point in the history
…onal

Don't create an ownership certificate if the key isn't set
  • Loading branch information
pixeltrix authored May 9, 2024
2 parents 21a687e + c3107e9 commit 85aa7cb
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def planning_designations
def process_ownership_certificate_details(planning_application)
return unless data_params[:applicant].key?(:ownership)
ownership_details = data_params[:applicant][:ownership]
return unless ownership_details.key?(:certificate)

ActiveRecord::Base.transaction do
ownership_certificate = OwnershipCertificate.create!(planning_application:, certificate_type: ownership_details[:certificate])
Expand Down
28 changes: 27 additions & 1 deletion engines/bops_api/spec/requests/v2/planning_applications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
create(:application_type, :pa_part_14_class_j)
create(:application_type, :householder)
create(:application_type, :householder_retrospective)

Rails.configuration.os_vector_tiles_api_key = "testtest"
end

let(:Authorization) { "Bearer bRPkCPjaZExpUYptBJDVFzss" }
Expand Down Expand Up @@ -68,7 +70,31 @@

let(:planning_application) { example_fixture(fixture) }

run_test!
run_test! do
[
["myPlans.pdf", "planx/odp/myPlans.pdf", "application/pdf"],
["other.pdf", "planx/odp/other.pdf", "application/pdf"],
["elevations.pdf", "planx/odp/elevations.pdf", "application/pdf"],
["floor_plans.pdf", "planx/odp/floor_plans.pdf", "application/pdf"],
["correspondence.pdf", "planx/odp/correspondence.pdf", "application/pdf"],
["heritageStatement.pdf", "planx/odp/heritageStatement.pdf", "application/pdf"],
["invoice.pdf", "planx/odp/invoice.pdf", "application/pdf"]
].each do |file, fixture, content_type|
stub_request(:get, %r{\Ahttps://api.editor.planx.dev/file/private/\w+/#{Regexp.escape(file)}\z})
.with(headers: {"Api-Key" => "G41sAys9uPMUVBH5WUKsYE4H"})
.to_return(
status: 200,
body: file_fixture(fixture).read,
headers: {"Content-Type" => content_type}
)
end

latitude = value.dig(:data, :property, :address, :latitude)
longitude = value.dig(:data, :property, :address, :longitude)
stub_os_places_api_request_for_radius(latitude, longitude)

perform_enqueued_jobs
end
end
end

Expand Down
Binary file added spec/fixtures/files/planx/odp/correspondence.pdf
Binary file not shown.
Binary file added spec/fixtures/files/planx/odp/elevations.pdf
Binary file not shown.
Binary file added spec/fixtures/files/planx/odp/floor_plans.pdf
Binary file not shown.
Binary file not shown.
Binary file added spec/fixtures/files/planx/odp/invoice.pdf
Binary file not shown.
Binary file added spec/fixtures/files/planx/odp/myPlans.pdf
Binary file not shown.
Binary file added spec/fixtures/files/planx/odp/other.pdf
Binary file not shown.

0 comments on commit 85aa7cb

Please sign in to comment.