Fakultas Ilmu Komputer UI

tests.py 1.05 KB
Newer Older
1
2
from django.test import TestCase, Client
from django.urls import resolve
Samuel Dimas's avatar
Samuel Dimas committed
3

igor lestin sianipar's avatar
igor lestin sianipar committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#class TemplateLoaderTest(TestCase):
#    def test_template_loader_url_exist(self):
#        url = "/test-page.html"
#        response = Client().get(url)
#        self.assertEqual(response.status_code,200)
#
#    def test_template_loader_using_template_loader_template(self):
#        url = "/test-page.html"
#        response = Client().get(url)
#        expected_template_name = "test-page.html"
#        self.assertTemplateUsed(response, expected_template_name)
#
#    def test_template_loader_using_template_loader_func(self):
#        url = "/test-page.html"
#        found = resolve(url)
#        expected_view_name = "pages"
#        self.assertEqual(found.func.__name__, expected_view_name)
#
#    def test_template_loader_handle_non_existent_html(self):
#        url = "/test.html"
#        expected_template_name = "error-404.html"
#        response = Client().get(url)
#        self.assertEqual(response.status_code,200)
#       self.assertTemplateUsed(response, expected_template_name)