Skip to content

Commit

Permalink
New tests to post replies
Browse files Browse the repository at this point in the history
  • Loading branch information
urtzai committed Mar 15, 2017
1 parent ed6731c commit a18760d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions django_forum_app/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,19 @@ def test_new_topic_post(self):
response = c.post(url, {'title': "I don't like The Beatles", 'description': "It's the worst band of the history!"})
topic_url = reverse('topic-detail', kwargs={'slug': "the-beatles", 'topic_id': 2})
self.assertRedirects(response, topic_url)

def test_close_topic_post(self):
c = Client()
c.login(username='john', password='johnpassword')
url = reverse('close-topic', kwargs={'slug': "the-beatles", "topic_id": 1})
response = c.get(url)
topic_url = reverse('topic-detail', kwargs={'slug': "the-beatles", 'topic_id': 1})
self.assertRedirects(response, topic_url)

def test_post_reply(self):
c = Client()
c.login(username='john', password='johnpassword')
url = reverse('reply', kwargs={'slug': "the-beatles", "topic_id": 1})
response = c.post(url, {'title': "I think you are wrong", 'body': "Not sure, but that's not the first album!"})
topic_url = reverse('topic-detail', kwargs={'slug': "the-beatles", 'topic_id': 1})
self.assertRedirects(response, topic_url)

0 comments on commit a18760d

Please sign in to comment.