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

Method _test_handshake

test/test_client.py:2022–2037  ·  view source on GitHub ↗
(self, env_vars, expected_env)

Source from the content-addressed store, hash-verified

2020 self.assertNotIn("ServerHeartbeatFailedEvent", log_output)
2021
2022 def _test_handshake(self, env_vars, expected_env):
2023 with patch.dict("os.environ", env_vars):
2024 metadata = copy.deepcopy(_METADATA)
2025 if has_c():
2026 metadata["driver"]["name"] = "PyMongo|c"
2027 else:
2028 metadata["driver"]["name"] = "PyMongo"
2029 if expected_env is not None:
2030 metadata["env"] = expected_env
2031
2032 if "AWS_REGION" not in env_vars:
2033 os.environ["AWS_REGION"] = ""
2034 client = self.rs_or_single_client(serverSelectionTimeoutMS=10000)
2035 client.admin.command("ping")
2036 options = client.options
2037 self.assertEqual(options.pool_options.metadata, metadata)
2038
2039 def test_handshake_01_aws(self):
2040 self._test_handshake(

Calls 3

has_cFunction · 0.90
rs_or_single_clientMethod · 0.80
commandMethod · 0.45

Tested by

no test coverage detected