MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / test_init_disconnected_with_srv

Method test_init_disconnected_with_srv

test/test_client.py:863–910  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

861 @client_context.require_no_load_balancer
862 @client_context.require_tls
863 def test_init_disconnected_with_srv(self):
864 c = self.rs_or_single_client(
865 "mongodb+srv://test1.test.build.10gen.cc", connect=False, tlsInsecure=True
866 )
867 # nodes returns an empty set if not connected
868 self.assertEqual(c.nodes, frozenset())
869 # topology_description returns the initial seed description if not connected
870 topology_description = c.topology_description
871 self.assertEqual(topology_description.topology_type, TOPOLOGY_TYPE.Unknown)
872 self.assertEqual(
873 {
874 ("test1.test.build.10gen.cc", None): ServerDescription(
875 ("test1.test.build.10gen.cc", None)
876 )
877 },
878 topology_description.server_descriptions(),
879 )
880
881 # address causes client to block until connected
882 self.assertIsNotNone(c.address)
883 # Initial seed topology and connected topology have the same ID
884 self.assertEqual(
885 c._topology._topology_id, topology_description._topology_settings._topology_id
886 )
887 c.close()
888
889 c = self.rs_or_single_client(
890 "mongodb+srv://test1.test.build.10gen.cc", connect=False, tlsInsecure=True
891 )
892 # primary causes client to block until connected
893 c.primary
894 self.assertIsNotNone(c._topology)
895 c.close()
896
897 c = self.rs_or_single_client(
898 "mongodb+srv://test1.test.build.10gen.cc", connect=False, tlsInsecure=True
899 )
900 # secondaries causes client to block until connected
901 c.secondaries
902 self.assertIsNotNone(c._topology)
903 c.close()
904
905 c = self.rs_or_single_client(
906 "mongodb+srv://test1.test.build.10gen.cc", connect=False, tlsInsecure=True
907 )
908 # arbiters causes client to block until connected
909 c.arbiters
910 self.assertIsNotNone(c._topology)
911
912 def test_equality(self):
913 seed = "{}:{}".format(*list(self.client._topology_settings.seeds)[0])

Callers

nothing calls this directly

Calls 4

ServerDescriptionClass · 0.90
rs_or_single_clientMethod · 0.80
server_descriptionsMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected