mirror of https://github.com/docker/docker-py.git
Fix B005 (probably an actual bug too)
Signed-off-by: Aarni Koskela <akx@iki.fi>
This commit is contained in:
parent
6aec90a41b
commit
09f12f2046
|
@ -77,5 +77,6 @@ def get_context_host(path=None, tls=False):
|
||||||
host = utils.parse_host(path, IS_WINDOWS_PLATFORM, tls)
|
host = utils.parse_host(path, IS_WINDOWS_PLATFORM, tls)
|
||||||
if host == DEFAULT_UNIX_SOCKET:
|
if host == DEFAULT_UNIX_SOCKET:
|
||||||
# remove http+ from default docker socket url
|
# remove http+ from default docker socket url
|
||||||
return host.strip("http+")
|
if host.startswith("http+"):
|
||||||
|
host = host[5:]
|
||||||
return host
|
return host
|
||||||
|
|
|
@ -13,7 +13,7 @@ class BaseContextTest(unittest.TestCase):
|
||||||
)
|
)
|
||||||
def test_url_compatibility_on_linux(self):
|
def test_url_compatibility_on_linux(self):
|
||||||
c = Context("test")
|
c = Context("test")
|
||||||
assert c.Host == DEFAULT_UNIX_SOCKET.strip("http+")
|
assert c.Host == DEFAULT_UNIX_SOCKET[5:]
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
not IS_WINDOWS_PLATFORM, reason='Windows specific path check'
|
not IS_WINDOWS_PLATFORM, reason='Windows specific path check'
|
||||||
|
@ -45,5 +45,7 @@ class BaseContextTest(unittest.TestCase):
|
||||||
ctx = ContextAPI.inspect_context()
|
ctx = ContextAPI.inspect_context()
|
||||||
assert ctx["Name"] == "default"
|
assert ctx["Name"] == "default"
|
||||||
assert ctx["Metadata"]["StackOrchestrator"] == "swarm"
|
assert ctx["Metadata"]["StackOrchestrator"] == "swarm"
|
||||||
assert ctx["Endpoints"]["docker"]["Host"] in [
|
assert ctx["Endpoints"]["docker"]["Host"] in (
|
||||||
DEFAULT_NPIPE, DEFAULT_UNIX_SOCKET.strip("http+")]
|
DEFAULT_NPIPE,
|
||||||
|
DEFAULT_UNIX_SOCKET[5:],
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue