Browse Source

CLDC-2277 Add missing bulk upload sales error mappings (#1623)

# Context

- https://digital.dclg.gov.uk/jira/browse/CLDC-2277
- Issues with sales 2023 and UPRN + new fields

# Changes

- Add missing error mappings for sales 2023
pull/1636/head
Phil Lee 2 years ago committed by GitHub
parent
commit
a50fff656c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      app/services/bulk_upload/sales/year2023/row_parser.rb
  2. 29
      spec/services/bulk_upload/sales/year2023/row_parser_spec.rb

17
app/services/bulk_upload/sales/year2023/row_parser.rb

@ -672,6 +672,23 @@ private
socprevten: %i[field_102], socprevten: %i[field_102],
mortgageused: %i[field_105 field_119 field_128], mortgageused: %i[field_105 field_119 field_128],
soctenant: %i[field_99], soctenant: %i[field_99],
uprn: %i[field_19],
address_line1: %i[field_20],
address_line2: %i[field_21],
town_or_city: %i[field_22],
county: %i[field_23],
ethnic_group2: %i[field_40],
ethnicbuy2: %i[field_40],
nationalbuy2: %i[field_41],
buy2living: %i[field_71],
prevtenbuy2: %i[field_72],
prevshared: %i[field_85],
staircasesale: %i[field_90],
} }
end end

29
spec/services/bulk_upload/sales/year2023/row_parser_spec.rb

@ -156,6 +156,25 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do
stub_request(:get, "https://api.os.uk/search/places/v1/uprn?key=OS_DATA_KEY&uprn=100023336956") stub_request(:get, "https://api.os.uk/search/places/v1/uprn?key=OS_DATA_KEY&uprn=100023336956")
.to_return(status: 200, body:, headers: {}) .to_return(status: 200, body:, headers: {})
body = {
header: {
uri: "https://api.os.uk/search/places/v1/uprn?uprn=2",
query: "uprn=2",
offset: 0,
totalresults: 0,
format: "JSON",
dataset: "DPA",
lr: "EN,CY",
maxresults: 100,
epoch: "101",
lastupdate: "2023-05-11",
output_srs: "EPSG:27700",
},
}.to_json
stub_request(:get, "https://api.os.uk/search/places/v1/uprn?key=OS_DATA_KEY&uprn=2")
.to_return(status: 200, body:, headers: {})
parser.valid? parser.valid?
end end
@ -533,7 +552,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do
end end
describe "#field_19" do # UPRN describe "#field_19" do # UPRN
context "when UPRN known" do context "when UPRN known and lookup found" do
let(:attributes) { setup_section_params.merge({ field_19: "100023336956" }) } let(:attributes) { setup_section_params.merge({ field_19: "100023336956" }) }
it "is valid" do it "is valid" do
@ -562,6 +581,14 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do
expect(parser.errors[:field_19]).to be_present expect(parser.errors[:field_19]).to be_present
end end
end end
context "when UPRN entered but no lookup found" do
let(:attributes) { setup_section_params.merge({ field_19: "2" }) }
it "is not valid" do
expect(parser.errors[:field_19]).to be_present
end
end
end end
[ [

Loading…
Cancel
Save