(self, env_vars, expected_env)
| 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( |
no test coverage detected