If listen on all interface do not return localhost as console

Fix https://github.com/GNS3/gns3-gui/issues/1574
This commit is contained in:
Julien Duponchelle
2016-10-17 18:20:29 +02:00
parent f737989e44
commit a8ffaa9cb5
3 changed files with 19 additions and 3 deletions

View File

@ -43,9 +43,17 @@ def test_init(compute):
def test_getUrl(controller):
compute = Compute("my_compute_id", protocol="https", host="localhost", port=84, controller=controller)
assert compute._getUrl("/test") == "https://localhost:84/v2/compute/test"
# IPV6 localhost
compute = Compute("my_compute_id", protocol="https", host="::1", port=84, controller=controller)
assert compute._getUrl("/test") == "https://[::1]:84/v2/compute/test"
# Listen on all interfaces aka 0.0.0.0 require us to connect via 127.0.0.1
compute = Compute("my_compute_id", protocol="https", host="0.0.0.0", port=84, controller=controller)
assert compute._getUrl("/test") == "https://127.0.0.1:84/v2/compute/test"
# IPV6
compute = Compute("my_compute_id", protocol="https", host="::", port=84, controller=controller)
assert compute._getUrl("/test") == "https://[::1]:84/v2/compute/test"
def test_host_ip(controller):
compute = Compute("my_compute_id", protocol="https", host="localhost", port=84, controller=controller)