File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -77,5 +77,6 @@ def get_context_host(path=None, tls=False):
77
77
host = utils .parse_host (path , IS_WINDOWS_PLATFORM , tls )
78
78
if host == DEFAULT_UNIX_SOCKET :
79
79
# remove http+ from default docker socket url
80
- return host .strip ("http+" )
80
+ if host .startswith ("http+" ):
81
+ host = host [5 :]
81
82
return host
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class BaseContextTest(unittest.TestCase):
13
13
)
14
14
def test_url_compatibility_on_linux (self ):
15
15
c = Context ("test" )
16
- assert c .Host == DEFAULT_UNIX_SOCKET . strip ( "http+" )
16
+ assert c .Host == DEFAULT_UNIX_SOCKET [ 5 :]
17
17
18
18
@pytest .mark .skipif (
19
19
not IS_WINDOWS_PLATFORM , reason = 'Windows specific path check'
@@ -45,5 +45,7 @@ def test_context_inspect_without_params(self):
45
45
ctx = ContextAPI .inspect_context ()
46
46
assert ctx ["Name" ] == "default"
47
47
assert ctx ["Metadata" ]["StackOrchestrator" ] == "swarm"
48
- assert ctx ["Endpoints" ]["docker" ]["Host" ] in [
49
- DEFAULT_NPIPE , DEFAULT_UNIX_SOCKET .strip ("http+" )]
48
+ assert ctx ["Endpoints" ]["docker" ]["Host" ] in (
49
+ DEFAULT_NPIPE ,
50
+ DEFAULT_UNIX_SOCKET [5 :],
51
+ )
You can’t perform that action at this time.
0 commit comments