Browse Source

Some uprn and export tests

further-bulk-upload-year-fixes
Kat 2 years ago
parent
commit
cdb4c28046
  1. 2
      spec/fixtures/exports/general_needs_log.csv
  2. 8
      spec/fixtures/exports/general_needs_log.xml
  3. 6
      spec/fixtures/exports/general_needs_log_23_24.xml
  4. 2
      spec/fixtures/exports/supported_housing_logs.xml
  5. 3
      spec/models/sales_log_spec.rb

2
spec/fixtures/exports/general_needs_log.csv vendored

@ -1,2 +1,2 @@
status,tenancycode,age1,sex1,ethnic,national,prevten,ecstat1,hhmemb,age2,sex2,ecstat2,age3,sex3,ecstat3,age4,sex4,ecstat4,age5,sex5,ecstat5,age6,sex6,ecstat6,age7,sex7,ecstat7,age8,sex8,ecstat8,homeless,underoccupation_benefitcap,leftreg,reservist,illness,preg_occ,startertenancy,tenancylength,tenancy,ppostcode_full,rsnvac,unittype_gn,beds,offered,wchair,earnings,incfreq,benefits,period,layear,waityear,postcode_full,reasonpref,cbl,chr,cap,reasonother,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,illness_type_1,illness_type_2,illness_type_3,illness_type_4,illness_type_8,illness_type_5,illness_type_6,illness_type_7,illness_type_9,illness_type_10,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,tenancyother,irproduct_other,reason,propcode,la,prevloc,hb,hbrentshortfall,mrcdate,incref,startdate,armedforces,unitletas,builtype,voiddate,renttype,needstype,lettype,totchild,totelder,totadult,nocharge,referral,brent,scharge,pscharge,supcharg,tcharge,tshortfall,chcharge,ppcodenk,has_benefits,renewal,wrent,wscharge,wpschrge,wsupchrg,wtcharge,wtshortfall,refused,housingneeds,wchchrg,newprop,relat2,relat3,relat4,relat5,relat6,relat7,relat8,lar,irproduct,joint,sheltered,hhtype,new_old,vacdays,uprn,uprn_known,uprn_confirmed,address_line1,address_line2,town_or_city,county,formid,owningorgid,owningorgname,hcnum,maningorgid,maningorgname,manhcnum,createddate,uploaddate status,tenancycode,age1,sex1,ethnic,national,prevten,ecstat1,hhmemb,age2,sex2,ecstat2,age3,sex3,ecstat3,age4,sex4,ecstat4,age5,sex5,ecstat5,age6,sex6,ecstat6,age7,sex7,ecstat7,age8,sex8,ecstat8,homeless,underoccupation_benefitcap,leftreg,reservist,illness,preg_occ,startertenancy,tenancylength,tenancy,ppostcode_full,rsnvac,unittype_gn,beds,offered,wchair,earnings,incfreq,benefits,period,layear,waityear,postcode_full,reasonpref,cbl,chr,cap,reasonother,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,illness_type_1,illness_type_2,illness_type_3,illness_type_4,illness_type_8,illness_type_5,illness_type_6,illness_type_7,illness_type_9,illness_type_10,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,tenancyother,irproduct_other,reason,propcode,la,prevloc,hb,hbrentshortfall,mrcdate,incref,startdate,armedforces,unitletas,builtype,voiddate,renttype,needstype,lettype,totchild,totelder,totadult,nocharge,referral,brent,scharge,pscharge,supcharg,tcharge,tshortfall,chcharge,ppcodenk,has_benefits,renewal,wrent,wscharge,wpschrge,wsupchrg,wtcharge,wtshortfall,refused,housingneeds,wchchrg,newprop,relat2,relat3,relat4,relat5,relat6,relat7,relat8,lar,irproduct,joint,sheltered,hhtype,new_old,vacdays,uprn,uprn_known,uprn_confirmed,address_line1,address_line2,town_or_city,county,formid,owningorgid,owningorgname,hcnum,maningorgid,maningorgname,manhcnum,createddate,uploaddate
2,BZ737,35,F,2,13,6,0,2,32,M,6,,,,,,,,,,,,,,,,,,,1,4,4,1,1,2,1,5,1,SE2 6RT,6,7,3,2,1,68,1,1,2,2,7,NW1 5TY,1,2,1,2,,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,,,4,123,E09000003,E07000105,6,1,2020-05-05T10:36:49+01:00,0,2022-02-02T10:36:49+00:00,1,2,1,2019-11-03T00:00:00+00:00,2,1,7,0,0,2,0,2,200.0,50.0,40.0,35.0,325.0,12.0,,1,1,0,100.0,25.0,20.0,17.5,162.5,6.0,0,1,,2,P,,,,,,,,,,,4,2,638,,,,,,,,{id},{owning_org_id},DLUHC,1234,{managing_org_id},DLUHC,1234,2022-05-01T00:00:00+01:00,2022-05-01T00:00:00+01:00 2,BZ737,35,F,2,13,6,0,2,32,M,6,,,,,,,,,,,,,,,,,,,1,4,4,1,1,2,1,5,4,SE2 6RT,6,7,3,2,1,68,1,1,2,2,7,NW1 5TY,1,2,1,2,,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,,,4,123,E09000003,E07000105,6,1,2020-05-05T10:36:49+01:00,0,2022-02-02T10:36:49+00:00,1,2,1,2019-11-03T00:00:00+00:00,2,1,7,0,0,2,0,2,200.0,50.0,40.0,35.0,325.0,12.0,,1,1,0,100.0,25.0,20.0,17.5,162.5,6.0,0,1,,2,P,,,,,,,,,3,,4,2,638,,0,,fake address,,London,,{id},{owning_org_id},DLUHC,1234,{managing_org_id},DLUHC,1234,2022-05-01T00:00:00+01:00,2022-05-01T00:00:00+01:00

1 status tenancycode age1 sex1 ethnic national prevten ecstat1 hhmemb age2 sex2 ecstat2 age3 sex3 ecstat3 age4 sex4 ecstat4 age5 sex5 ecstat5 age6 sex6 ecstat6 age7 sex7 ecstat7 age8 sex8 ecstat8 homeless underoccupation_benefitcap leftreg reservist illness preg_occ startertenancy tenancylength tenancy ppostcode_full rsnvac unittype_gn beds offered wchair earnings incfreq benefits period layear waityear postcode_full reasonpref cbl chr cap reasonother housingneeds_a housingneeds_b housingneeds_c housingneeds_f housingneeds_g housingneeds_h illness_type_1 illness_type_2 illness_type_3 illness_type_4 illness_type_8 illness_type_5 illness_type_6 illness_type_7 illness_type_9 illness_type_10 rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow tenancyother irproduct_other reason propcode la prevloc hb hbrentshortfall mrcdate incref startdate armedforces unitletas builtype voiddate renttype needstype lettype totchild totelder totadult nocharge referral brent scharge pscharge supcharg tcharge tshortfall chcharge ppcodenk has_benefits renewal wrent wscharge wpschrge wsupchrg wtcharge wtshortfall refused housingneeds wchchrg newprop relat2 relat3 relat4 relat5 relat6 relat7 relat8 lar irproduct joint sheltered hhtype new_old vacdays uprn uprn_known uprn_confirmed address_line1 address_line2 town_or_city county formid owningorgid owningorgname hcnum maningorgid maningorgname manhcnum createddate uploaddate
2 2 BZ737 35 F 2 13 6 0 2 32 M 6 1 4 4 1 1 2 1 5 1 4 SE2 6RT 6 7 3 2 1 68 1 1 2 2 7 NW1 5TY 1 2 1 2 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 4 123 E09000003 E07000105 6 1 2020-05-05T10:36:49+01:00 0 2022-02-02T10:36:49+00:00 1 2 1 2019-11-03T00:00:00+00:00 2 1 7 0 0 2 0 2 200.0 50.0 40.0 35.0 325.0 12.0 1 1 0 100.0 25.0 20.0 17.5 162.5 6.0 0 1 2 P 3 4 2 638 0 fake address London {id} {owning_org_id} DLUHC 1234 {managing_org_id} DLUHC 1234 2022-05-01T00:00:00+01:00 2022-05-01T00:00:00+01:00

8
spec/fixtures/exports/general_needs_log.xml vendored

@ -39,7 +39,7 @@
<preg_occ>2</preg_occ> <preg_occ>2</preg_occ>
<startertenancy>1</startertenancy> <startertenancy>1</startertenancy>
<tenancylength>5</tenancylength> <tenancylength>5</tenancylength>
<tenancy>1</tenancy> <tenancy>4</tenancy>
<ppostcode_full>SE2 6RT</ppostcode_full> <ppostcode_full>SE2 6RT</ppostcode_full>
<rsnvac>6</rsnvac> <rsnvac>6</rsnvac>
<unittype_gn>7</unittype_gn> <unittype_gn>7</unittype_gn>
@ -136,11 +136,11 @@
<new_old>2</new_old> <new_old>2</new_old>
<vacdays>638</vacdays> <vacdays>638</vacdays>
<uprn/> <uprn/>
<uprn_known/> <uprn_known>0</uprn_known>
<uprn_confirmed/> <uprn_confirmed/>
<address_line1/> <address_line1>fake address</address_line1>
<address_line2/> <address_line2/>
<town_or_city/> <town_or_city>London</town_or_city>
<county/> <county/>
<formid>{id}</formid> <formid>{id}</formid>
<owningorgid>{owning_org_id}</owningorgid> <owningorgid>{owning_org_id}</owningorgid>

6
spec/fixtures/exports/general_needs_log_23_24.xml vendored

@ -38,8 +38,8 @@
<illness>1</illness> <illness>1</illness>
<preg_occ>2</preg_occ> <preg_occ>2</preg_occ>
<startertenancy>1</startertenancy> <startertenancy>1</startertenancy>
<tenancylength/> <tenancylength>5</tenancylength>
<tenancy/> <tenancy>4</tenancy>
<ppostcode_full>SE2 6RT</ppostcode_full> <ppostcode_full>SE2 6RT</ppostcode_full>
<rsnvac>6</rsnvac> <rsnvac>6</rsnvac>
<unittype_gn>7</unittype_gn> <unittype_gn>7</unittype_gn>
@ -131,7 +131,7 @@
<relat8/> <relat8/>
<lar/> <lar/>
<irproduct/> <irproduct/>
<joint/> <joint>3</joint>
<sheltered/> <sheltered/>
<hhtype>4</hhtype> <hhtype>4</hhtype>
<new_old>2</new_old> <new_old>2</new_old>

2
spec/fixtures/exports/supported_housing_logs.xml vendored

@ -39,7 +39,7 @@
<preg_occ>2</preg_occ> <preg_occ>2</preg_occ>
<startertenancy>1</startertenancy> <startertenancy>1</startertenancy>
<tenancylength/> <tenancylength/>
<tenancy>1</tenancy> <tenancy>4</tenancy>
<ppostcode_full>LE5 1QP</ppostcode_full> <ppostcode_full>LE5 1QP</ppostcode_full>
<rsnvac>6</rsnvac> <rsnvac>6</rsnvac>
<beds/> <beds/>

3
spec/models/sales_log_spec.rb

@ -537,6 +537,7 @@ RSpec.describe SalesLog, type: :model do
it "updates sales log fields" do it "updates sales log fields" do
sales_log.uprn = "1111111" sales_log.uprn = "1111111"
sales_log.uprn_confirmed = 1
allow_any_instance_of(UprnClient).to receive(:call) allow_any_instance_of(UprnClient).to receive(:call)
allow_any_instance_of(UprnClient).to receive(:result).and_return({ allow_any_instance_of(UprnClient).to receive(:result).and_return({
@ -567,7 +568,7 @@ RSpec.describe SalesLog, type: :model do
end end
context "when service errors" do context "when service errors" do
let(:sales_log) { create(:sales_log, uprn: "123456789", uprn_confirmed: 1) } let(:sales_log) { create(:sales_log, uprn_known: 1, uprn: "123456789", uprn_confirmed: 1) }
let(:error_message) { "error" } let(:error_message) { "error" }
it "adds error to sales log" do it "adds error to sales log" do

Loading…
Cancel
Save