Skip to content

Commit d634ba0

Browse files
committed
RDBC-780 DeleteByQueryTest::canDeleteByQuery
1 parent 46f26ed commit d634ba0

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from ravendb import IndexQuery, DeleteByQueryOperation
2+
from ravendb.infrastructure.entities import User
3+
from ravendb.tests.test_base import TestBase
4+
5+
6+
class TestDeleteByQuery(TestBase):
7+
def setUp(self):
8+
super().setUp()
9+
10+
def test_can_delete_by_query(self):
11+
with self.store.open_session() as session:
12+
session.store(User(age=5))
13+
session.store(User(age=10))
14+
session.save_changes()
15+
16+
index_query = IndexQuery("from users where age == 5")
17+
operation = DeleteByQueryOperation(index_query)
18+
async_op = self.store.operations.send_async(operation)
19+
20+
async_op.wait_for_completion()
21+
22+
with self.store.open_session() as session:
23+
self.assertEqual(1, session.query(object_type=User).count())

0 commit comments

Comments
 (0)