dynamicweb2/ungleich_page/test_views.py

24 lines
711 B
Python
Raw Permalink Normal View History

2023-12-06 11:16:19 +00:00
from django.test import TestCase
from django.urls import reverse
from django.urls import resolve
class ContactViewTest(TestCase):
def setUp(self):
self.url = reverse('ungleich_page:contact')
self.data = {
'name': 'test',
'email': 'test@gmail.com',
'phone_number': '32123123123123',
'message': 'This is a message',
}
def url_resolve_to_view_correctly(self):
found = resolve(self.url)
self.assertEqual(found.func.__name__, self.view.__name__)
def test_any_user_should_contact_us(self):
response = self.client.post(self.url, self.data, follow=True)
self.assertEqual(response.status_code, 200)