-
-
Save vitorfs/e17216ce3d92110cf7e005ce3288c587 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.test import TestCase | |
from django.urls import resolve, reverse | |
from ..models import Board | |
from ..views import BoardListView | |
class HomeTests(TestCase): | |
def setUp(self): | |
self.board = Board.objects.create(name='Django', description='Django board.') | |
url = reverse('home') | |
self.response = self.client.get(url) | |
def test_home_view_status_code(self): | |
self.assertEquals(self.response.status_code, 200) | |
def test_home_url_resolves_home_view(self): | |
view = resolve('/') | |
self.assertEquals(view.func.view_class, BoardListView) | |
def test_home_view_contains_link_to_topics_page(self): | |
board_topics_url = reverse('board_topics', kwargs={'pk': self.board.pk}) | |
self.assertContains(self.response, 'href="{0}"'.format(board_topics_url)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment