This test uses MongoClient explicitly to make sure that host and port are not overloaded.
(self)
| 793 | self.assertEqual(1, len(server._pool.conns)) |
| 794 | |
| 795 | def test_constants(self): |
| 796 | """This test uses MongoClient explicitly to make sure that host and |
| 797 | port are not overloaded. |
| 798 | """ |
| 799 | host, port = client_context.host, client_context.port |
| 800 | kwargs: dict = client_context.default_client_options.copy() |
| 801 | if client_context.auth_enabled: |
| 802 | kwargs["username"] = db_user |
| 803 | kwargs["password"] = db_pwd |
| 804 | |
| 805 | # Set bad defaults. |
| 806 | MongoClient.HOST = "somedomainthatdoesntexist.org" |
| 807 | MongoClient.PORT = 123456789 |
| 808 | with self.assertRaises(AutoReconnect): |
| 809 | c = self.simple_client(serverSelectionTimeoutMS=10, **kwargs) |
| 810 | connected(c) |
| 811 | |
| 812 | c = self.simple_client(host, port, **kwargs) |
| 813 | # Override the defaults. No error. |
| 814 | connected(c) |
| 815 | |
| 816 | # Set good defaults. |
| 817 | MongoClient.HOST = host |
| 818 | MongoClient.PORT = port |
| 819 | |
| 820 | # No error. |
| 821 | c = self.simple_client(**kwargs) |
| 822 | connected(c) |
| 823 | |
| 824 | def test_init_disconnected(self): |
| 825 | host, port = client_context.host, client_context.port |
nothing calls this directly
no test coverage detected