File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 3535import pytest
3636
3737from pymongo import AsyncMongoClient , monitoring
38- from pymongo .asynchronous .auth import HAVE_KERBEROS
38+ from pymongo .asynchronous .auth import HAVE_KERBEROS , _canonicalize_hostname
3939from pymongo .auth_shared import _build_credentials_tuple
4040from pymongo .errors import OperationFailure
4141from pymongo .hello import HelloCompat
@@ -331,6 +331,12 @@ async def test_gssapi_host_name(self):
331331 )
332332 await client .server_info ()
333333
334+ def test_canonicalize_host_name (self ):
335+ result = _canonicalize_hostname (GSSAPI_HOST , "forward" )
336+ self .assertIn ("compute-1.amazonaws.com" , result )
337+ result = _canonicalize_hostname (GSSAPI_HOST , "forwardAndReverse" )
338+ self .assertEqual (result , GSSAPI_HOST )
339+
334340
335341class TestSASLPlain (AsyncPyMongoTestCase ):
336342 @classmethod
Original file line number Diff line number Diff line change 4040from pymongo .hello import HelloCompat
4141from pymongo .read_preferences import ReadPreference
4242from pymongo .saslprep import HAVE_STRINGPREP
43- from pymongo .synchronous .auth import HAVE_KERBEROS
43+ from pymongo .synchronous .auth import HAVE_KERBEROS , _canonicalize_hostname
4444
4545_IS_SYNC = True
4646
@@ -331,6 +331,12 @@ def test_gssapi_host_name(self):
331331 )
332332 client .server_info ()
333333
334+ def test_canonicalize_host_name (self ):
335+ result = _canonicalize_hostname (GSSAPI_HOST , "forward" )
336+ self .assertIn ("compute-1.amazonaws.com" , result )
337+ result = _canonicalize_hostname (GSSAPI_HOST , "forwardAndReverse" )
338+ self .assertEqual (result , GSSAPI_HOST )
339+
334340
335341class TestSASLPlain (PyMongoTestCase ):
336342 @classmethod
You can’t perform that action at this time.
0 commit comments