Exemplo n.º 1
0
def test_get_country_by_ip(ip_data, expected_country, monkeypatch):
    monkeypatch.setattr(
        'saleor.core.utils.geolite2.reader',
        Mock(return_value=Mock(get=Mock(return_value=ip_data))))
    country = get_country_by_ip('127.0.0.1')
    assert country == expected_country
Exemplo n.º 2
0
def test_get_country_by_ip(ip_data, expected_country, monkeypatch):
    monkeypatch.setattr('saleor.core.utils.georeader.get',
                        Mock(return_value=ip_data))
    country = get_country_by_ip('127.0.0.1')
    assert country == expected_country
Exemplo n.º 3
0
def test_get_country_by_ip(ip_data, expected_country, monkeypatch):
    monkeypatch.setattr("saleor.core.utils.georeader.get", Mock(return_value=ip_data))
    country = get_country_by_ip("127.0.0.1")
    assert country == expected_country