@@ -815,39 +815,6 @@ async def test_constants(self):
815
815
816
816
async def test_init_disconnected (self ):
817
817
host , port = await async_client_context .host , await async_client_context .port
818
- c = await self .async_rs_or_single_client (connect = False )
819
- # nodes returns an empty set if not connected
820
- self .assertEqual (c .nodes , frozenset ())
821
- # topology_description returns the initial seed description if not connected
822
- topology_description = c .topology_description
823
- self .assertEqual (topology_description .topology_type , TOPOLOGY_TYPE .Unknown )
824
- self .assertEqual (
825
- topology_description .server_descriptions (),
826
- {(host , port ): ServerDescription ((host , port ))},
827
- )
828
-
829
- # address causes client to block until connected
830
- self .assertIsNotNone (await c .address )
831
- # Initial seed topology and connected topology have the same ID
832
- self .assertEqual (
833
- c ._topology ._topology_id , topology_description ._topology_settings ._topology_id
834
- )
835
-
836
- c = await self .async_rs_or_single_client (connect = False )
837
- # primary causes client to block until connected
838
- await c .primary
839
- self .assertIsNotNone (c ._topology )
840
-
841
- c = await self .async_rs_or_single_client (connect = False )
842
- # secondaries causes client to block until connected
843
- await c .secondaries
844
- self .assertIsNotNone (c ._topology )
845
-
846
- c = await self .async_rs_or_single_client (connect = False )
847
- # arbiters causes client to block until connected
848
- await c .arbiters
849
- self .assertIsNotNone (c ._topology )
850
-
851
818
c = await self .async_rs_or_single_client (connect = False )
852
819
# is_primary causes client to block until connected
853
820
self .assertIsInstance (await c .is_primary , bool )
@@ -882,6 +849,54 @@ async def test_init_disconnected_with_auth(self):
882
849
with self .assertRaises (ConnectionFailure ):
883
850
await c .pymongo_test .test .find_one ()
884
851
852
+ @async_client_context .require_replica_set
853
+ @async_client_context .require_tls
854
+ async def test_init_disconnected_with_srv (self ):
855
+ c = await self .async_rs_or_single_client (
856
+ "mongodb+srv://test1.test.build.10gen.cc" , connect = False , tlsInsecure = True
857
+ )
858
+ # nodes returns an empty set if not connected
859
+ self .assertEqual (c .nodes , frozenset ())
860
+ # topology_description returns the initial seed description if not connected
861
+ topology_description = c .topology_description
862
+ self .assertEqual (topology_description .topology_type , TOPOLOGY_TYPE .Unknown )
863
+ self .assertEqual (
864
+ {
865
+ ("test1.test.build.10gen.cc" , None ): ServerDescription (
866
+ ("test1.test.build.10gen.cc" , None )
867
+ )
868
+ },
869
+ topology_description .server_descriptions (),
870
+ )
871
+
872
+ # address causes client to block until connected
873
+ self .assertIsNotNone (await c .address )
874
+ # Initial seed topology and connected topology have the same ID
875
+ self .assertEqual (
876
+ c ._topology ._topology_id , topology_description ._topology_settings ._topology_id
877
+ )
878
+
879
+ c = await self .async_rs_or_single_client (
880
+ "mongodb+srv://test1.test.build.10gen.cc" , connect = False , tlsInsecure = True
881
+ )
882
+ # primary causes client to block until connected
883
+ await c .primary
884
+ self .assertIsNotNone (c ._topology )
885
+
886
+ c = await self .async_rs_or_single_client (
887
+ "mongodb+srv://test1.test.build.10gen.cc" , connect = False , tlsInsecure = True
888
+ )
889
+ # secondaries causes client to block until connected
890
+ await c .secondaries
891
+ self .assertIsNotNone (c ._topology )
892
+
893
+ c = await self .async_rs_or_single_client (
894
+ "mongodb+srv://test1.test.build.10gen.cc" , connect = False , tlsInsecure = True
895
+ )
896
+ # arbiters causes client to block until connected
897
+ await c .arbiters
898
+ self .assertIsNotNone (c ._topology )
899
+
885
900
async def test_equality (self ):
886
901
seed = "{}:{}" .format (* list (self .client ._topology_settings .seeds )[0 ])
887
902
c = await self .async_rs_or_single_client (seed , connect = False )
0 commit comments