def test_url_no_scheme_expect_usage_error(self): """Test that the host (no slash, no scheme, no www) will throw an error""" error = None try: UrlBuilder.build(template='/', host=self.host_no_scheme, scheme=None) except ValueError, error: pass
def test_port_in_host_and_port_override(self): """Test that the returned url will have the override port when a url with a different port is specified""" port_override = 8000 url = UrlBuilder.build(template='/', host=self.data.url_with_port, port=port_override) self.assertEqual(url, 'http://urlwithport.com:8000/')
def test_relative_url(self): url = UrlBuilder.build(template=self.no_host_relative_path, host=None) self.assertEqual(self.no_host_relative_path, url)
def test_full_url(self): """Test that the full url supplied as the host will return the full url""" url = UrlBuilder.build(template='/', host=self.host_full_url) assert url == 'http://fullurl.com/', 'Full url was not built correctly: "{}"'.format(url)
def test_full_url(self): """Test that the full url supplied as the host will return the full url""" url = UrlBuilder.build(template='/', host=self.host_full_url) assert url == 'http://fullurl.com/', 'Full url was not built correctly: "{}"'.format( url)
def test_port_in_host(self): """Test that the full url supplied as the host with a port will return the full url when no port is specified""" url = UrlBuilder.build(template='/', host=self.data.url_with_port) self.assertEqual(url, self.data.url_with_port)