(self)
| 905 | coll.bulk_write([InsertOne({"x": 1})]) |
| 906 | |
| 907 | def test_no_remove(self): |
| 908 | # We test that an authorization failure aborts the batch and is raised |
| 909 | # as OperationFailure. |
| 910 | cli = self.rs_or_single_client_noauth( |
| 911 | username="noremove", password="pw", authSource="pymongo_test" |
| 912 | ) |
| 913 | coll = cli.pymongo_test.test |
| 914 | coll.find_one() |
| 915 | requests = [ |
| 916 | InsertOne({"x": 1}), |
| 917 | ReplaceOne({"x": 2}, {"x": 2}, upsert=True), |
| 918 | DeleteMany({}), # Prohibited. |
| 919 | InsertOne({"x": 3}), # Never attempted. |
| 920 | ] |
| 921 | with self.assertRaises(OperationFailure): |
| 922 | coll.bulk_write(requests) # type: ignore[arg-type] |
| 923 | self.assertEqual({1, 2}, set(self.coll.distinct("x"))) |
| 924 | |
| 925 | |
| 926 | class TestBulkWriteConcern(BulkTestBase): |
nothing calls this directly
no test coverage detected