def test_cleanup_location():
    """ Testing cleaning up the location data """

    # Test United States fix
    test_location = {
        'country_code': 'UNITED STATES'
    }
    assert {'country_code': 'USA', 'country_name': None} == recipients.cleanup_location(test_location)

    # Test Country_Code
    mommy.make(RefCountryCode, country_code='USA', country_name='UNITED STATES')
    test_location = {
        'country_code': 'USA'
    }
    assert {'country_code': 'USA', 'country_name': 'UNITED STATES'} == recipients.cleanup_location(test_location)

    # Test Congressional Codes
    test_location = {
        'congressional_code': 'CA13'
    }
    assert {'congressional_code': '13'} == recipients.cleanup_location(test_location)
    test_location = {
        'congressional_code': '13.0'
    }
    assert {'congressional_code': '13'} == recipients.cleanup_location(test_location)
def test_cleanup_location():
    """ Testing cleaning up the location data """

    # Test United States fix
    test_location = {"country_code": "UNITED STATES"}
    assert {
        "country_code": "USA",
        "country_name": None
    } == recipients.cleanup_location(test_location)

    # Test Country_Code
    mommy.make(RefCountryCode,
               country_code="USA",
               country_name="UNITED STATES")
    test_location = {"country_code": "USA"}
    assert {
        "country_code": "USA",
        "country_name": "UNITED STATES"
    } == recipients.cleanup_location(test_location)

    # Test Congressional Codes
    test_location = {"congressional_code": "CA13"}
    assert {
        "congressional_code": "13"
    } == recipients.cleanup_location(test_location)
    test_location = {"congressional_code": "13.0"}
    assert {
        "congressional_code": "13"
    } == recipients.cleanup_location(test_location)
def test_cleanup_location():
    """ Testing cleaning up the location data """

    # Test United States fix
    test_location = {'country_code': 'UNITED STATES'}
    assert {
        'country_code': 'USA',
        'country_name': None
    } == recipients.cleanup_location(test_location)

    # Test Country_Code
    mommy.make(RefCountryCode,
               country_code='USA',
               country_name='UNITED STATES')
    test_location = {'country_code': 'USA'}
    assert {
        'country_code': 'USA',
        'country_name': 'UNITED STATES'
    } == recipients.cleanup_location(test_location)

    # Test Congressional Codes
    test_location = {'congressional_code': 'CA13'}
    assert {
        'congressional_code': '13'
    } == recipients.cleanup_location(test_location)
    test_location = {'congressional_code': '13.0'}
    assert {
        'congressional_code': '13'
    } == recipients.cleanup_location(test_location)