This test uses AsyncMongoClient explicitly to make sure that host and port are not overloaded.
(self)
| 818 | self.assertEqual(1, len(server._pool.conns)) |
| 819 | |
| 820 | async def test_constants(self): |
| 821 | """This test uses AsyncMongoClient explicitly to make sure that host and |
| 822 | port are not overloaded. |
| 823 | """ |
| 824 | host, port = await async_client_context.host, await async_client_context.port |
| 825 | kwargs: dict = async_client_context.default_client_options.copy() |
| 826 | if async_client_context.auth_enabled: |
| 827 | kwargs["username"] = db_user |
| 828 | kwargs["password"] = db_pwd |
| 829 | |
| 830 | # Set bad defaults. |
| 831 | AsyncMongoClient.HOST = "somedomainthatdoesntexist.org" |
| 832 | AsyncMongoClient.PORT = 123456789 |
| 833 | with self.assertRaises(AutoReconnect): |
| 834 | c = self.simple_client(serverSelectionTimeoutMS=10, **kwargs) |
| 835 | await connected(c) |
| 836 | |
| 837 | c = self.simple_client(host, port, **kwargs) |
| 838 | # Override the defaults. No error. |
| 839 | await connected(c) |
| 840 | |
| 841 | # Set good defaults. |
| 842 | AsyncMongoClient.HOST = host |
| 843 | AsyncMongoClient.PORT = port |
| 844 | |
| 845 | # No error. |
| 846 | c = self.simple_client(**kwargs) |
| 847 | await connected(c) |
| 848 | |
| 849 | async def test_init_disconnected(self): |
| 850 | host, port = await async_client_context.host, await async_client_context.port |
nothing calls this directly
no test coverage detected