def test_get_icon_url_bigger_pk(self): website = Website(pk=98765432, icon_type='image/png') if not storage_is_remote(): expected = (static_url('WEBSITE_ICON_URL') % (str(website.pk)[:-3], website.pk, 32, 'never')) else: path = '%s/%s-%s.png' % (website.get_icon_dir(), website.pk, 32) expected = '%s?modified=never' % public_storage.url(path) assert website.get_icon_url(32).endswith(expected), ( 'Expected %s, got %s' % (expected, website.get_icon_url(32)))
def test_get_icon_url_bigger_pk(self): website = Website(pk=98765432, icon_type="image/png") if not storage_is_remote(): expected = static_url("WEBSITE_ICON_URL") % (str(website.pk)[:-3], website.pk, 32, "never") else: path = "%s/%s-%s.png" % (website.get_icon_dir(), website.pk, 32) expected = "%s?modified=never" % storage.url(path) assert website.get_icon_url(32).endswith(expected), "Expected %s, got %s" % (expected, website.get_icon_url(32))
def test_get_icon_no_icon_pink(self): website = Website(pk=164) url = website.get_icon_url(32) assert url.endswith('hub/europe-africa-pink-32.png'), url
def test_get_icon_no_icon_blue(self): website = Website(pk=8) url = website.get_icon_url(32) assert url.endswith('hub/asia-australia-blue-32.png'), url
def test_get_icon_url_hash(self): website = Website(pk=1, icon_type='image/png', icon_hash='abcdef') assert website.get_icon_url(32).endswith('?modified=abcdef')
def test_get_icon_url_bigger_pk(self): website = Website(pk=98765432, icon_type='image/png') expected = (static_url('WEBSITE_ICON_URL') % (str(website.pk)[:-3], website.pk, 32, 'never')) assert website.get_icon_url(32).endswith(expected), ( 'Expected %s, got %s' % (expected, website.get_icon_url(32)))
def test_get_icon_url(self): website = Website(pk=1, icon_type='image/png') expected = (static_url('WEBSITE_ICON_URL') % ('0', website.pk, 32, 'never')) assert website.get_icon_url(32).endswith(expected), ( 'Expected %s, got %s' % (expected, website.get_icon_url(32)))
def test_get_icon_no_icon(self): website = Website(pk=1) assert website.get_icon_url(32).endswith('/default-32.png')
def test_get_icon_url_hash(self): website = Website(pk=1, icon_type="image/png", icon_hash="abcdef") assert website.get_icon_url(32).endswith("?modified=abcdef")