예제 #1
0
 def test__parses_URL_with_IPv6_address(self):
     ip = factory.make_ipv6_address().encode("ascii")
     path = factory.make_name("path").encode("ascii")
     uri = get_patched_URI().fromBytes(b"http://[%s]/%s" % (ip, path))
     self.expectThat(uri.host, Equals(b"%s" % ip))
     self.expectThat(uri.path, Equals(b"/%s" % path))
     self.expectThat(uri.port, Equals(80))
예제 #2
0
파일: test_monkey.py 프로젝트: zhangrb/maas
 def test__parses_URL_with_IPv6_address(self):
     ip = factory.make_ipv6_address().encode('ascii')
     path = factory.make_name('path').encode('ascii')
     uri = get_patched_URI().fromBytes(b'http://[%s]/%s' % (ip, path))
     self.expectThat(uri.host, Equals(b'%s' % ip))
     self.expectThat(uri.path, Equals(b'/%s' % path))
     self.expectThat(uri.port, Equals(80))
예제 #3
0
 def test__parses_URL_with_hostname(self):
     hostname = factory.make_name("host").encode("ascii")
     path = factory.make_name("path").encode("ascii")
     uri = get_patched_URI().fromBytes(b"http://%s/%s" % (hostname, path))
     self.expectThat(uri.host, Equals(hostname))
     self.expectThat(uri.path, Equals(b"/%s" % path))
     self.expectThat(uri.port, Equals(80))
예제 #4
0
파일: test_monkey.py 프로젝트: zhangrb/maas
 def test__parses_URL_with_hostname(self):
     hostname = factory.make_name('host').encode('ascii')
     path = factory.make_name('path').encode('ascii')
     uri = get_patched_URI().fromBytes(b'http://%s/%s' % (hostname, path))
     self.expectThat(uri.host, Equals(hostname))
     self.expectThat(uri.path, Equals(b'/%s' % path))
     self.expectThat(uri.port, Equals(80))
예제 #5
0
 def test__parses_URL_with_IPv4_address_and_port(self):
     ip = factory.make_ipv4_address().encode("ascii")
     port = factory.pick_port()
     path = factory.make_name("path").encode("ascii")
     uri = get_patched_URI().fromBytes(b"http://%s:%d/%s" %
                                       (ip, port, path))
     self.expectThat(uri.host, Equals(ip))
     self.expectThat(uri.path, Equals(b"/%s" % path))
     self.expectThat(uri.port, Equals(port))