Example #1
0
def test_melissa_apply_global_address():

    client = geo.Melissa("")

    data = client.apply_global_address(
        {
            "address1": "address1 old",
            "city": "city old",
            "zipcode": "zipcode old",
        },
        {
            "Results": "AV25",
            "FormattedAddress": "address1 new;address2 new",
            "AdministrativeArea": "state new",
            "AddressLine1": "address1 new",
            "AddressLine2": "address2 new",
            "Latitude": 1.234567,
            "Longitude": 1.234567,
            "PostalCode": "zipcode new",
            "Locality": "city new",
        },
    )

    expected = {
        "address1": "address1 new",
        "address2": "address2 new",
        "city": "city new",
        "zipcode": "zipcode new",
        "longitude": 1.234567,
        "latitude": 1.234567,
        "state": "state new",
    }

    assert data == expected
Example #2
0
def test_melissa_global_address_best_result():
    client = geo.Melissa("")

    expected = {"Results": "AV25", "Address1": "value1"}

    result = {"Records": [expected, {"Results": "AV25", "Address1": "value2"}]}

    assert client.global_address_best_result(result) == expected
    assert client.global_address_best_result({}) == None
    assert client.global_address_best_result(None) == None

    result = {"Records": [{"Results": "AV12", "Address1": "value2"}]}

    assert client.global_address_best_result(result) == None
Example #3
0
def test_melissa_global_address_params():
    client = geo.Melissa("")

    expected = {
        "a1": "address 1",
        "a2": "address 2",
        "ctry": "us",
        "loc": "city",
        "postal": "12345",
    }

    assert (client.global_address_params(
        address1="address 1",
        address2="address 2",
        country="us",
        city="city",
        zipcode="12345",
    ) == expected)