(self)
| 1042 | self.assertCountEqual(db_names, cmd_names) |
| 1043 | |
| 1044 | def test_drop_database(self): |
| 1045 | with self.assertRaises(TypeError): |
| 1046 | self.client.drop_database(5) # type: ignore[arg-type] |
| 1047 | with self.assertRaises(TypeError): |
| 1048 | self.client.drop_database(None) # type: ignore[arg-type] |
| 1049 | |
| 1050 | self.client.pymongo_test.test.insert_one({"dummy": "object"}) |
| 1051 | self.client.pymongo_test2.test.insert_one({"dummy": "object"}) |
| 1052 | dbs = self.client.list_database_names() |
| 1053 | self.assertIn("pymongo_test", dbs) |
| 1054 | self.assertIn("pymongo_test2", dbs) |
| 1055 | self.client.drop_database("pymongo_test") |
| 1056 | |
| 1057 | if client_context.is_rs: |
| 1058 | wc_client = self.rs_or_single_client(w=len(client_context.nodes) + 1) |
| 1059 | with self.assertRaises(WriteConcernError): |
| 1060 | wc_client.drop_database("pymongo_test2") |
| 1061 | |
| 1062 | self.client.drop_database(self.client.pymongo_test2) |
| 1063 | dbs = self.client.list_database_names() |
| 1064 | self.assertNotIn("pymongo_test", dbs) |
| 1065 | self.assertNotIn("pymongo_test2", dbs) |
| 1066 | |
| 1067 | def test_close(self): |
| 1068 | test_client = self.rs_or_single_client() |
nothing calls this directly
no test coverage detected