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 35
35
import pytest
36
36
37
37
from pymongo import AsyncMongoClient , monitoring
38
- from pymongo .asynchronous .auth import HAVE_KERBEROS
38
+ from pymongo .asynchronous .auth import HAVE_KERBEROS , _canonicalize_hostname
39
39
from pymongo .auth_shared import _build_credentials_tuple
40
40
from pymongo .errors import OperationFailure
41
41
from pymongo .hello import HelloCompat
@@ -331,6 +331,12 @@ async def test_gssapi_host_name(self):
331
331
)
332
332
await client .server_info ()
333
333
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
+
334
340
335
341
class TestSASLPlain (AsyncPyMongoTestCase ):
336
342
@classmethod
Original file line number Diff line number Diff line change 40
40
from pymongo .hello import HelloCompat
41
41
from pymongo .read_preferences import ReadPreference
42
42
from pymongo .saslprep import HAVE_STRINGPREP
43
- from pymongo .synchronous .auth import HAVE_KERBEROS
43
+ from pymongo .synchronous .auth import HAVE_KERBEROS , _canonicalize_hostname
44
44
45
45
_IS_SYNC = True
46
46
@@ -331,6 +331,12 @@ def test_gssapi_host_name(self):
331
331
)
332
332
client .server_info ()
333
333
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
+
334
340
335
341
class TestSASLPlain (PyMongoTestCase ):
336
342
@classmethod
You can’t perform that action at this time.
0 commit comments