def test_read_country_code():
    with OpenPostgreSQLsshTunnel(port=5435) as pport:
        engine = create_db_engine(port=pport)
        country_code = read_country_code(engine)

    print(len(country_code))
    assert len(country_code) == 250
    assert country_code['IL'] == 'Israel'
def test_read_country_code():
    with OpenPostgreSQLsshTunnel(port=5435) as pport:
        engine = create_db_engine(port=pport)
        country_code = read_country_code(engine)

    print(len(country_code))
    assert len(country_code) == 250
    assert country_code['IL'] == 'Israel'
def test_find_originating_country():
    with OpenPostgreSQLsshTunnel(port=5434) as pport:
        engine = create_db_engine(port=pport)
        country_list = read_country_code(engine)

    host = 'host-219-235-1-84.iphost.gotonets.com'
    country = find_originating_country(hostname=host,
                                       country_code_list=country_list)
    assert country == 'CN'
def test_find_originating_country():
    with OpenPostgreSQLsshTunnel(port=5434) as pport:
        engine = create_db_engine(port=pport)
        country_list = read_country_code(engine)

    host = 'host-219-235-1-84.iphost.gotonets.com'
    country = find_originating_country(hostname=host,
                                       country_code_list=country_list)
    assert country == 'CN'