Example #1
0
def test_lookup_landlord_command_uses_nycha(db, loaded_nycha_csv_data):
    with patch('loc.landlord_lookup._lookup_bbl_and_bin_and_full_address',
               return_value=('3005380001', '',
                             '453 COLUMBIA STREET, Brooklyn blahblahblah')):
        results = lookup_landlord('453 columbia st, Brooklyn')
        assert results.name == "RED HOOK EAST MANAGEMENT"
        assert results.address == "62 MILL STREET\nBROOKLYN, NY 11231"
Example #2
0
 def handle(self, *args, **options) -> None:
     info = lookup_landlord(options["address"])
     if info is None:
         raise CommandError("Landlord lookup failed!")
     self.stdout.write(f"Landlord name: {info.name}")
     self.stdout.write(
         f"Landlord primary address line: {info.primary_line}")
     self.stdout.write(f"Landlord city / state / zip: "
                       f"{info.city} / {info.state} / {info.zip_code}")
     self.stdout.write(f"Landlord full mailing address:\n")
     for line in info.address.splitlines():
         self.stdout.write(f"  {line}")
Example #3
0
def test_search_returns_none_on_bad_result(requests_mock):
    requests_mock.get(settings.GEOCODING_SEARCH_URL, json=EXAMPLE_GEO_SEARCH)
    assert lookup_landlord("150 court, brooklyn") is None
Example #4
0
def test_lookup_landlord_returns_none_on_geocoding_500(requests_mock):
    requests_mock.get(settings.GEOCODING_SEARCH_URL, status_code=500)
    assert lookup_landlord("150 court, brooklyn") is None
Example #5
0
 def handle(self, *args, **options) -> None:
     info = lookup_landlord(options['address'])
     if info is None:
         raise CommandError('Landlord lookup failed!')
     self.stdout.write(f"Landlord name: {info.name}")
     self.stdout.write(f"Landlord address: {info.address}")