Esempio n. 1
0
def test_address_lines_for_mailing():
    info = OnboardingInfo()
    assert info.address_lines_for_mailing == []

    info.address = "150 Boop Way"
    assert info.address_lines_for_mailing == ["150 Boop Way"]

    info.apt_number = "2"
    assert info.address_lines_for_mailing == ["150 Boop Way", "Apartment 2"]

    info.borough = "MANHATTAN"
    info.state = "NY"
    assert info.address_lines_for_mailing == [
        "150 Boop Way", "Apartment 2", "New York, NY"
    ]

    info.zipcode = "11201"
    assert info.address_lines_for_mailing == [
        "150 Boop Way", "Apartment 2", "New York, NY 11201"
    ]

    info.borough = ""
    info.non_nyc_city = "Beetville"
    info.state = "OH"
    info.zipcode = "43210"
    assert info.address_lines_for_mailing == [
        "150 Boop Way", "Apartment 2", "Beetville, OH 43210"
    ]
Esempio n. 2
0
def test_city_works():
    info = OnboardingInfo()
    assert info.city == ''

    info.borough = 'STATEN_ISLAND'
    assert info.city == 'Staten Island'

    info.borough = 'MANHATTAN'
    assert info.city == 'New York'
Esempio n. 3
0
def test_borough_label_works():
    info = OnboardingInfo()
    assert info.borough_label == ''

    info.borough = 'STATEN_ISLAND'
    assert info.borough_label == 'Staten Island'

    info.borough = 'MANHATTAN'
    assert info.borough_label == 'Manhattan'
Esempio n. 4
0
def test_borough_label_works():
    info = OnboardingInfo()
    assert info.borough_label == ""

    info.borough = "STATEN_ISLAND"
    assert info.borough_label == "Staten Island"

    info.borough = "MANHATTAN"
    assert info.borough_label == "Manhattan"
Esempio n. 5
0
def test_city_works():
    info = OnboardingInfo()
    assert info.city == ""

    info.non_nyc_city = "Beetville"
    assert info.city == "Beetville"

    info.non_nyc_city = ""
    info.borough = "STATEN_ISLAND"
    assert info.city == "Staten Island"

    info.borough = "MANHATTAN"
    assert info.city == "New York"
Esempio n. 6
0
def test_full_address_works():
    info = OnboardingInfo()
    assert info.full_address == ''

    info.borough = 'STATEN_ISLAND'
    assert info.full_address == ''

    info.address = '123 Boop street'
    assert info.full_address == '123 Boop street, Staten Island'
Esempio n. 7
0
def test_full_nyc_address_works():
    info = OnboardingInfo()
    assert info.full_nyc_address == ""

    info.borough = "STATEN_ISLAND"
    assert info.full_nyc_address == ""

    info.address = "123 Boop street"
    assert info.full_nyc_address == "123 Boop street, Staten Island"
Esempio n. 8
0
def test_address_lines_for_mailing():
    info = OnboardingInfo()
    assert info.address_lines_for_mailing == []

    info.address = "150 Boop Way"
    assert info.address_lines_for_mailing == ["150 Boop Way"]

    info.apt_number = "2"
    assert info.address_lines_for_mailing == ["150 Boop Way", "Apartment 2"]

    info.borough = "MANHATTAN"
    assert info.address_lines_for_mailing == [
        "150 Boop Way", "Apartment 2", "New York, NY"
    ]

    info.zipcode = "11201"
    assert info.address_lines_for_mailing == [
        "150 Boop Way", "Apartment 2", "New York, NY 11201"
    ]
Esempio n. 9
0
    def convert_national_to_nyc_addr_if_needed(self,
                                               info: OnboardingInfo) -> bool:
        if not (info.geocoded_address and info.non_nyc_city
                and info.state == US_STATE_CHOICES.NY):
            return False

        info.update_geocoded_point_from_geometry()
        county = info.lookup_county()
        assert county, f"geocoded NYC address '{info.geocoded_address}' should have a county!"

        if county in NYC_COUNTY_BOROUGHS:
            self.log(
                f"National address at '{info.geocoded_address}' appears to be in NYC."
            )
            info.borough = NYC_COUNTY_BOROUGHS[county]
            info.non_nyc_city = ""
            info.geocoded_address = ""
            assert info.maybe_lookup_new_addr_metadata()
            return True

        return False