def test_entry_detail_200(self): self.authenticate() entry = GlossaryEntry(**self.entry_data) entry.save() path = reverse('glossary-entry-delete', kwargs={'pk' : entry.pk}) response = self.client.get(path) self.assertEqual(response.status_code, 200)
def test_requires_auth(self): entry = GlossaryEntry(**self.entry_data) entry.save() path = reverse('glossary-entry-delete', kwargs={'pk' : entry.pk}) response = self.client.get(path) self.assertRedirects(response, reverse('login') + "?next=" + path )
def test_replaces(self): # Initialize an entry with an article article = GlossaryArticle(**self.article_data) article.save() entry = GlossaryEntry(**self.entry_data) entry.article = article entry.save() # Get the link to the entry (with article) link = reverse('glossary-entry-detail', kwargs={'pk': entry.id}) # Compare expectation vs acutal result result = insert_links(entry.term) expectation = '<a href="{link}">{term}</a>'.format(link=link, term=entry.term) self.assertEqual(result, expectation)