def test_convert_dt_refs_to_links_no_duped_links(self): review = models.Review.create_review(**self.default_review_kwargs) text = tasks.convert_dt_refs_to_links('link to DT-{}'.format( review.pk)) self.assertEqual( text, 'link to <a href="/DT-{}/" target="_blank">DT-{}</a>'.format( review.pk, review.pk)) text = tasks.convert_dt_refs_to_links(text) self.assertEqual( text, 'link to <a href="/DT-{}/" target="_blank">DT-{}</a>'.format( review.pk, review.pk))
def test_convert_dt_refs_to_links_no_drafts(self): self.default_review_kwargs['state'] = constants.DRAFT review = models.Review.create_review(**self.default_review_kwargs) text = tasks.convert_dt_refs_to_links('link to DT-{}'.format( review.pk)) # No changes, because the review is a draft self.assertEqual(text, 'link to DT-{}'.format(review.pk))
def test_convert_dt_refs_to_links_ignore_bad_links(self): text = tasks.convert_dt_refs_to_links('link to dt-1231241') self.assertEqual(text, 'link to dt-1231241')