File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,8 +96,6 @@ def __init__(
9696 except Exception :
9797 raise ConfigurationError (_INVALID_HOST_MSG % (fqdn ,)) from None
9898 self .__slen = len (self .__plist )
99- if self .__slen < 2 :
100- raise ConfigurationError (_INVALID_HOST_MSG % (fqdn ,))
10199
102100 async def get_options (self ) -> Optional [str ]:
103101 from dns import resolver
Original file line number Diff line number Diff line change @@ -96,8 +96,6 @@ def __init__(
9696 except Exception :
9797 raise ConfigurationError (_INVALID_HOST_MSG % (fqdn ,)) from None
9898 self .__slen = len (self .__plist )
99- if self .__slen < 2 :
100- raise ConfigurationError (_INVALID_HOST_MSG % (fqdn ,))
10199
102100 def get_options (self ) -> Optional [str ]:
103101 from dns import resolver
Original file line number Diff line number Diff line change 2424sys .path [0 :0 ] = ["" ]
2525
2626from test import unittest
27+ from unittest .mock import patch
2728
2829from bson .binary import JAVA_LEGACY
2930from pymongo import ReadPreference
@@ -553,6 +554,11 @@ def test_port_with_whitespace(self):
553554 with self .assertRaisesRegex (ValueError , r"Port contains whitespace character: '\\n'" ):
554555 parse_uri ("mongodb://localhost:27\n 017" )
555556
557+ def test_allow_srv_hosts_with_fewer_than_three_dot_separated_parts (self ):
558+ with patch ("dns.resolver.resolve" ):
559+ parse_uri ("mongodb+srv://localhost/" )
560+ parse_uri ("mongodb+srv://mongo.local/" )
561+
556562
557563if __name__ == "__main__" :
558564 unittest .main ()
You can’t perform that action at this time.
0 commit comments