Exemplo n.º 1
0
    def test_init(self):
        host_ip = self.VALID_IP
        port = self.MAX_ALLOWED_PORT
        endpoint = ServiceEndpoint(host_ip, port)
        assert endpoint.host_ip == host_ip
        assert endpoint.port == port

        port = self.MIN_ALLOWED_PORT
        endpoint = ServiceEndpoint(host_ip, port)
        assert endpoint.host_ip == host_ip
        assert endpoint.port == port
Exemplo n.º 2
0
 def test_init_with_invalid_ip(self):
     with pytest.raises(ValueError):
         host_ip = ""
         port = self.MAX_ALLOWED_PORT
         endpoint = ServiceEndpoint(host_ip, port)
         assert False
Exemplo n.º 3
0
 def test_init_with_too_large_port(self):
     with pytest.raises(ValueError):
         host_ip = self.VALID_IP
         port = self.MAX_ALLOWED_PORT + 1
         endpoint = ServiceEndpoint(host_ip, port)
         assert False
Exemplo n.º 4
0
 def test_init_with_minus_port(self):
     with pytest.raises(ValueError):
         host_ip = self.VALID_IP
         port = -1
         endpoint = ServiceEndpoint(host_ip, port)
         assert False