Fakultas Ilmu Komputer UI

tests.py 641 Bytes
Newer Older
Putu Agastya's avatar
Putu Agastya committed
1
2
from django.test import TestCase, Client
from django.urls import resolve
3
from .views import DaftarKatalog
Samuel Dimas's avatar
Samuel Dimas committed
4

Putu Agastya's avatar
Putu Agastya committed
5
6
7
8
class DaftarKatalogTest(TestCase):
    def test_daftar_katalog_url_exist(self):
        url = "/"
        response = Client().get(f'{url}')
9
10
11
12
        self.assertEqual(response.status_code,200)

    def test_daftar_katalog_using_daftar_katalog_template(self):
        response = Client().get('/')
13
        self.assertTemplateUsed(response, 'app/katalog_materi.html')
14
15
16
17

    def test_daftar_katalog_using_daftar_katalog_func(self):
        found = resolve('/')
        self.assertEqual(found.func.__name__, DaftarKatalog.as_view().__name__)