def verify_app_domain(manifest_url): if settings.WEBAPPS_UNIQUE_BY_DOMAIN: domain = Webapp.domain_from_url(manifest_url) if Addon.objects.filter(app_domain=domain).exists(): raise forms.ValidationError( _('An app already exists on this domain, ' 'only one app per domain is allowed.'))
def test_empty(self): Webapp.domain_from_url('')
def test_https(self): eq_(Webapp.domain_from_url('https://mozilla.com/'), 'mozilla.com')
def test_none(self): Webapp.domain_from_url(None)
def test_with_port(self): eq_(Webapp.domain_from_url('http://mozilla.com:9000/'), 'mozilla.com')
def test_subdomains(self): eq_(Webapp.domain_from_url('http://apps.mozilla.com/'), 'apps.mozilla.com')
def test_long_path(self): eq_(Webapp.domain_from_url('http://mozilla.com/super/rad.webapp'), 'mozilla.com')
def test_normalize_www(self): eq_(Webapp.domain_from_url('http://www.mozilla.com/super/rad.webapp'), 'mozilla.com')
def test_simple(self): eq_(Webapp.domain_from_url('http://mozilla.com/'), 'mozilla.com')