MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_service_name_from_kwargs

Method test_service_name_from_kwargs

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

Source from the content-addressed store, hash-verified

1947 coll.insert_many([{} for _ in range(5)])
1948
1949 def test_service_name_from_kwargs(self):
1950 client = MongoClient(
1951 "mongodb+srv://user:password@test22.test.build.10gen.cc",
1952 srvServiceName="customname",
1953 connect=False,
1954 )
1955 client._connect()
1956 self.assertEqual(client._topology_settings.srv_service_name, "customname")
1957 client.close()
1958 client = MongoClient(
1959 "mongodb+srv://user:password@test22.test.build.10gen.cc"
1960 "/?srvServiceName=shouldbeoverriden",
1961 srvServiceName="customname",
1962 connect=False,
1963 )
1964 client._connect()
1965 self.assertEqual(client._topology_settings.srv_service_name, "customname")
1966 client.close()
1967 client = MongoClient(
1968 "mongodb+srv://user:password@test22.test.build.10gen.cc/?srvServiceName=customname",
1969 connect=False,
1970 )
1971 client._connect()
1972 self.assertEqual(client._topology_settings.srv_service_name, "customname")
1973 client.close()
1974
1975 def test_srv_max_hosts_kwarg(self):
1976 client = self.simple_client("mongodb+srv://test1.test.build.10gen.cc/")

Callers

nothing calls this directly

Calls 3

_connectMethod · 0.95
closeMethod · 0.95
MongoClientClass · 0.90

Tested by

no test coverage detected