from django.conf import settings
from django.test import TestCase
from django.test import Client

from subscribe.models import Event


class TestCaseAdminLogin(TestCase):
    """Test case with client and login as admin function."""
    fixtures = ['test_data.json']

    def setUp(self):
        self.client = Client()
        self.login()

    def login(self):
        """Login as admin."""
        success = self.client.login(username='admin', password='admin123')
        self.assertTrue(success)
        response = self.client.get('/admin/', follow=True)
        self.assertEqual(response.status_code, 200)
        return response


class TestAdminPages(TestCaseAdminLogin):

    def test_event_edit_pages(self):
        events = Event.objects.all()
        for event in events:
            response = self.client.get('/admin/subscribe/event/' + str(event.id) + '/change/')
            self.assertEqual(response.status_code, 200)

@@ -89,16 +89,48 @@
 t Client
+%0Afrom django.urls import reverse
 %0A%0Afrom s
@@ -158,16 +158,1367 @@
 t Event%0A
+from subscribe.forms import SubscribeForm%0A%0A%0Aclass TestUserPages(TestCase):%0A    %22%22%22Test case with client for pages for normal user%22%22%22%0A    fixtures = %5B'test_data.json'%5D%0A%0A    def setUp(self):%0A        self.client = Client()%0A%0A    def test_view_homepage(self):%0A        response = self.client.get(reverse('homepage'))%0A        self.assertEqual(response.status_code, 200)%0A%0A    def test_view_subscribe_page(self):%0A        events = Event.objects.all()%0A        for event in events:%0A            response = self.client.get(reverse('subscribe', kwargs=%7B'slug': event.slug%7D))%0A            self.assertEqual(response.status_code, 200)%0A%0A    def test_subscribe_form(self):%0A        events = Event.objects.all()%0A        for event in events:%0A            form_data = %7B%0A                'first_name': 'John',%0A                'last_name': 'Doe',%0A                'email': 'john@doe.com',%0A            %7D%0A            form = SubscribeForm(event=event, data=form_data)%0A            self.assertTrue(form.is_valid())%0A%0A    def test_subscribe_form_empty_email(self):%0A        events = Event.objects.all()%0A        for event in events:%0A            form_data = %7B%0A                'first_name': '',%0A                'last_name': '',%0A                'email': 'john@doe.com',%0A            %7D%0A            form = SubscribeForm(event=event, data=form_data)%0A            self.assertFalse(form.is_valid())%0A%0A
 %0A%0Aclass 
@@ -1603,17 +1603,16 @@
 function
-.
 %22%22%22%0A    

Create tests for homepage, subscribe page and form