Skip to content

Commit

Permalink
change 'disable hostname checking' elif condition
Browse files Browse the repository at this point in the history
  • Loading branch information
jborbely committed Sep 21, 2023
1 parent e536e73 commit 0bd8f4d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion msl/network/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def _create_connection(self, **kwargs):
msg = 'Cannot connect to {host}:{port}'.format(**kwargs)
elif isinstance(error, (ConnectionRefusedError, socket.gaierror)):
msg += '\nCannot connect to {host}:{port}'.format(**kwargs)
elif 'mismatch' in msg or "doesn't match" in msg:
elif ('name mismatch' in msg) or ('address mismatch' in msg):
msg += '\nTo disable hostname checking set assert_hostname=False\n' \
'Make sure you trust the connection to {host}:{port} ' \
'if you decide to do this.'.format(**kwargs)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_wrong_certificate():
assert cryptography.generate_certificate(path=cert, key_path=key) == cert
kwargs = manager.kwargs.copy()
kwargs['cert_file'] = cert
with pytest.raises((ConnectionError, AssertionError)) as e:
with pytest.raises(ConnectionError) as e:
connect(**kwargs)
msg = str(e.value)
assert 'Perhaps the Network Manager is using a new certificate' in msg
Expand Down

0 comments on commit 0bd8f4d

Please sign in to comment.