ungleich_hack_3/tests.py

23 lines
719 B
Python
Raw Normal View History

from django.urls import reverse
from django.test import Client, TestCase
class UngleichScreeningTaskTests(TestCase):
def setUp(self):
self.ipv4_client = Client(REMOTE_ADDR="127.0.0.1")
self.ipv6_client = Client(REMOTE_ADDR="::1")
def test_project_using_ipv4(self):
url = reverse("index")
response = self.ipv4_client.get(url)
self.assertContains(
response, "Sorry, only reachable by IPv6", status_code=400, html=True
)
def test_project_using_ipv6(self):
url = reverse("index")
response = self.ipv6_client.get(url)
self.assertContains(
response, "A friendly cat picture", status_code=200, html=True
)