def test_returns_correct_full_url(self): link = Link(destination_url="http://example.com", short_url="foobarbaz", site=self.site) link.save() self.assertEqual(link.url, "http://%s/%s" % (self.site.domain, link.short_url))
def test_site_cannot_be_empty(self): link = Link(destination_url="http://example.com", short_url="foobarbaz", site_id="") link.save()
def test_short_url_cannot_be_blank(self): link = Link(destination_url="http://example.com", short_url="", site=self.site) link.save()
def test_short_url_cannot_be_null(self): link = Link(destination_url="http://example.com", short_url=None) link.save()
def test_destination_url_cannot_be_blank(self): link = Link(destination_url="", short_url="foobarbaz", site=self.site) link.save()
def given_a_link(site, user=None): link = Link(destination_url=EXAMPLE_URL, short_url="example", site=site) if user: link.user = user link.save() return link