class ContestSubmitURLViewUnit(BaseTestCase): def setUp(self): BaseTestCase.setUp(self) self.contest = self.create_contest(submissions_open=True) self.view = SubmitURLView() self.view.dispatch(self.factory.get('/'), pk=self.contest.pk, slug=self.contest.slug) def test_scraped_url(self): """ The scraped URL for this view is the 'localtv_contests_submit_scraped_video' view. """ self.assertEqual( self.view.scraped_url, reverse('localtv_contests_submit_scraped_video', args=[self.contest.pk, self.contest.slug])) def test_embed_url(self): """ The embed URL for this view is the 'localtv_contests_submit_embedrequest_video' view. """ self.assertEqual( self.view.embed_url, reverse('localtv_contests_submit_embedrequest_video', args=[self.contest.pk, self.contest.slug])) def test_directlink_url(self): """ The directlink URL for this view is the 'localtv_contests_submit_directlink_video' view. """ self.assertEqual( self.view.direct_url, reverse('localtv_contests_submit_directlink_video', args=[self.contest.pk, self.contest.slug])) def test_get_session_key(self): """ get_session_key() returns a session key keyed on the current site ID and the contest ID.""" self.assertEqual( self.view.get_session_key(), self.view.session_key_template % (settings.SITE_ID, self.contest.pk)) def test_get_context_data(self): """ get_context_data() includes the :class:`Contest` object under the 'contest' name. """ context = self.view.get_context_data(form=object()) self.assertEqual(context['contest'], self.contest)
class ContestSubmitURLViewUnit(BaseTestCase): def setUp(self): BaseTestCase.setUp(self) self.contest = self.create_contest(submissions_open=True) self.view = SubmitURLView() self.view.dispatch(self.factory.get("/"), pk=self.contest.pk, slug=self.contest.slug) def test_scraped_url(self): """ The scraped URL for this view is the 'localtv_contests_submit_scraped_video' view. """ self.assertEqual( self.view.scraped_url, reverse("localtv_contests_submit_scraped_video", args=[self.contest.pk, self.contest.slug]), ) def test_embed_url(self): """ The embed URL for this view is the 'localtv_contests_submit_embedrequest_video' view. """ self.assertEqual( self.view.embed_url, reverse("localtv_contests_submit_embedrequest_video", args=[self.contest.pk, self.contest.slug]), ) def test_directlink_url(self): """ The directlink URL for this view is the 'localtv_contests_submit_directlink_video' view. """ self.assertEqual( self.view.direct_url, reverse("localtv_contests_submit_directlink_video", args=[self.contest.pk, self.contest.slug]), ) def test_get_session_key(self): """ get_session_key() returns a session key keyed on the current site ID and the contest ID.""" self.assertEqual( self.view.get_session_key(), self.view.session_key_template % (settings.SITE_ID, self.contest.pk) ) def test_get_context_data(self): """ get_context_data() includes the :class:`Contest` object under the 'contest' name. """ context = self.view.get_context_data(form=object()) self.assertEqual(context["contest"], self.contest)