Example #1
0
 def test_skips_port_for_default_ports(self):
     self.assertEqual(
         "https://example.com/test",
         build_url(DummyRequest("example.com:443", "https"), "example.com",
                   "/test"))
     self.assertEqual(
         "http://example.com/test",
         build_url(DummyRequest("example.com:80", "http"), "example.com",
                   "/test"))
     self.assertEqual(
         "https://example.com:80/test",
         build_url(DummyRequest("example.com:80", "https"), "example.com",
                   "/test"))
     self.assertEqual(
         "http://example.com:443/test",
         build_url(DummyRequest("example.com:443", "http"), "example.com",
                   "/test"))
Example #2
0
 def test_uses_current_request_schema(self):
     self.assertEqual("https://example.com/test", build_url(DummyRequest("example.com", "https"), "example.com", "/test"))
Example #3
0
 def test_uses_current_request_port(self):
     self.assertEqual("http://example.com:5000/test", build_url(DummyRequest("example.com:5000", "http"), "example.com", "/test"))
Example #4
0
 def test_simple_case(self):
     self.assertEqual("http://example.com/test", build_url(DummyRequest("", "http"), "example.com", "/test"))
Example #5
0
 def test_simple_case(self):
     self.assertEqual("http://example.com/test", build_url(DummyRequest("", "http"), "example.com", "/test"))
Example #6
0
 def test_skips_port_for_default_ports(self):
     self.assertEqual("https://example.com/test", build_url(DummyRequest("example.com:443", "https"), "example.com", "/test"))
     self.assertEqual("http://example.com/test", build_url(DummyRequest("example.com:80", "http"), "example.com", "/test"))
     self.assertEqual("https://example.com:80/test", build_url(DummyRequest("example.com:80", "https"), "example.com", "/test"))
     self.assertEqual("http://example.com:443/test", build_url(DummyRequest("example.com:443", "http"), "example.com", "/test"))
Example #7
0
 def test_uses_current_request_schema(self):
     self.assertEqual("https://example.com/test", build_url(DummyRequest("example.com", "https"), "example.com", "/test"))
Example #8
0
 def test_uses_current_request_port(self):
     self.assertEqual("http://example.com:5000/test", build_url(DummyRequest("example.com:5000", "http"), "example.com", "/test"))