1
Fork 0
e11sync/app/signup/tests.py

22 lines
783 B
Python
Raw Normal View History

2024-01-11 23:36:15 +02:00
from django.test import TestCase, Client
from django.urls import reverse
def SignupViewTests(TestCase):
def setUp(self):
self.client = Client()
def test_index(self):
resp = self.client.get(reverse("index"))
self.assertEqual(response.status_code, 200)
self.assertContains(resp, "11sync is a privacy-respecting way")
def test_ok_signup(self):
resp = self.client.post(reverse("index"), {"email": "foo@example.com"},
follow = True,
HTTP_USER_AGENT = "foo-agent",
REMOTE_ADDR = "127.0.0.2")
self.assertEqual(resp.redirect_chain, ('http://testserver/?success', 302))
self.assertContains(resp, "You are now subscribed!")
2023-12-14 18:27:56 +02:00