Skip to content
This repository was archived by the owner on Sep 19, 2018. It is now read-only.

Commit 617e571

Browse files
committed
Merge pull request #393 from gandalfar/geoip_fix2
Tests for GeoIP Fix
2 parents 53c701f + fbb90bd commit 617e571

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

web/templates/pages/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
{% if country.country_code %}
4646
<a class="btn btn-primary btn-lg"
4747
href="{% url 'web.search_events' %}?country_code={{ country.country_code }}&amp;past={{ past }}">
48-
<i class="fa fa-list"></i> List all events <span id="country"> {{ country.country_name }}</span>
48+
<i class="fa fa-list"></i> List all events in <span id="country"> {{ country.country_name }}</span>
4949
</a>
5050
{% else %}
5151
<a class="btn btn-primary btn-lg" href="{% url 'web.search_events' %}">

web/tests/test_event_views.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,19 @@ def test_nonexistent_event(db, client):
235235

236236
assert response.status_code == 404
237237

238+
@pytest.mark.django_db
239+
def test_geoip_slovenian_ip(db, client):
240+
response = client.get('/', REMOTE_ADDR='93.103.53.1')
241+
242+
assert 'List all events in <span id="country"> Slovenia' in response.content
243+
244+
@pytest.mark.django_db
245+
def test_geoip_invalid_ip(db, client):
246+
response = client.get('/', REMOTE_ADDR='127.0.0.1')
247+
248+
assert 'List all events' in response.content
249+
assert 'List all events <span' not in response.content
250+
238251
@pytest.mark.django_db
239252
def test_list_events_for_country_code(db, client):
240253
response = client.get(reverse('web.view_event_by_country', args=['SI']))

0 commit comments

Comments
 (0)