Fakultas Ilmu Komputer UI

Commit b6ac1425 authored by Putu Agastya's avatar Putu Agastya
Browse files

[RED] Added test for template loader view.

parent 419adf5b
from django.test import TestCase
from django.test import TestCase, Client
from django.urls import resolve
# Create your tests here.
class TemplateLoaderTest(TestCase):
def test_template_loader_url_exist(self):
url = "/test-page.html"
response = Client().get(url)
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)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment