Example #1
0
 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))
Example #2
0
 def test_site_cannot_be_empty(self):
     link = Link(destination_url="http://example.com", short_url="foobarbaz", site_id="")
     link.save()
Example #3
0
 def test_short_url_cannot_be_blank(self):
     link = Link(destination_url="http://example.com", short_url="", site=self.site)
     link.save()
Example #4
0
 def test_short_url_cannot_be_null(self):
     link = Link(destination_url="http://example.com", short_url=None)
     link.save()
Example #5
0
 def test_destination_url_cannot_be_blank(self):
     link = Link(destination_url="", short_url="foobarbaz", site=self.site)
     link.save()
Example #6
0
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