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
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
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