Skip to content

Commit 706163b

Browse files
committed
GH-32: Add a case with mixed settings
1 parent 33ebe2f commit 706163b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test_location_middleware.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ def test_should_forbid_users_only_from_texas(get_response):
5353
assert not forbids(get_response, ip_address)
5454

5555

56+
@override_settings(DJANGO_FORBID={"COUNTRIES": ["!US:TX", "!US:IL", "GB"], "TERRITORIES": ["EU"]})
57+
def test_should_forbid_users_only_from_texas_and_illinois(get_response):
58+
"""Access is forbidden from Texas and Illinois."""
59+
for ip_address in IP.all:
60+
if ip_address in [*IP.locals, IP.ip_dallas]:
61+
assert forbids(get_response, ip_address)
62+
continue
63+
assert not forbids(get_response, ip_address)
64+
65+
5666
@override_settings(DJANGO_FORBID={"COUNTRIES": ["GB"]})
5767
def test_should_allow_country_when_country_in_countries_whitelist_otherwise_forbid(get_response):
5868
"""Access is granted from GB when GB is in the counties' whitelist."""

0 commit comments

Comments
 (0)