from django.test import TestCase

# Create your tests here.


class IngredientsPagesTests(TestCase):
    def test_ingredients_list_page(self):
        response = self.client.get('/ingredients_list/')
        self.assertContains(response, "Ingredients - List", html=True)
        self.assertTemplateUsed('ingredients_list.html')

    def test_ingredients_create_page(self):
        response = self.client.get('/ingredients_create/')
        self.assertContains(response, "Ingredients - Create", html=True)
        self.assertTemplateUsed('ingredients_create_form.html')

    def test_ingredients_update_page(self):
        response = self.client.get('/ingredients_update/')
        self.assertContains(response, "Ingredients - Update", html=True)
        self.assertTemplateUsed('ingredients_update_form.html')

    def test_ingredients_detail_page(self):
        response = self.client.get('/ingredients_detail/')
        self.assertContains(response, "Ingredients - Detail", html=True)
        self.assertTemplateUsed('ingredients_detail.html')


class OrdersPagesTests(TestCase):
    def test_orders_list_page(self):
        response = self.client.get('/orders_list/')
        self.assertContains(response, "Orders - List", html=True)
        self.assertTemplateUsed(response, 'orders_list.html')

    def test_orders_create_page(self):
        response = self.client.get('/orders_create/')
        self.assertContains(response, "Orders - Create", html=True)
        self.assertTemplateUsed(response, 'orders_create_form.html')

    def test_orders_update_page(self):
        response = self.client.get('/orders_update/')
        self.assertContains(response, "Orders - Update", html=True)
        self.assertTemplateUsed(response, 'orders_update_form.html')

    def test_orders_detail_page(self):
        response = self.client.get('/orders_detail/')
        self.assertContains(response, "Orders - Detail", html=True)
        self.assertTemplateUsed(response, 'orders_detail.html')


class RecipesPagesTests(TestCase):
    def test_recipes_list_page(self):
        response = self.client.get('/recipes_list/')
        self.assertContains(response, "Recipes - List", html=True)
        self.assertTemplateUsed(response, 'recipes_list.html')

    def test_recipes_create_page(self):
        response = self.client.get('/recipes_create/')
        self.assertContains(response, "Recipes - Create", html=True)
        self.assertTemplateUsed(response, 'recipes_create_form.html')

    def test_recipes_update_page(self):
        response = self.client.get('/recipes_update/')
        self.assertContains(response, "Recipes - Update", html=True)
        self.assertTemplateUsed(response, 'recipes_update_form.html')

    def test_recipes_detail_page(self):
        response = self.client.get('/recipes_detail/')
        self.assertContains(response, "Recipes - Detail", html=True)
        self.assertTemplateUsed(response, 'recipes_detail.html')


class HomePageTest(TestCase):
    def test_homepage(self):
        response = self.client.get('/')

        self.assertContains(response, "Recipes - Detail", html=True)
        self.assertContains(response, "Orders - Detail", html=True)
        self.assertContains(response, "Ingredients - Detail", html=True)

        self.assertContains(response, "Recipes - Create", html=True)
        self.assertContains(response, "Orders - Create", html=True)
        self.assertContains(response, "Ingredients - Create", html=True)

        self.assertContains(response, "Recipes - Update", html=True)
        self.assertContains(response, "Orders - Update", html=True)
        self.assertContains(response, "Ingredients - Update", html=True)

        self.assertContains(response, "Recipes - List", html=True)
        self.assertContains(response, "Orders - List", html=True)
        self.assertContains(response, "Ingredients - List", html=True)

        self.assertTemplateUsed(response, 'home.html')
