|
14 | 14 |
|
15 | 15 | from uuid import uuid4 |
16 | 16 | from cassandra.cqlengine import ValidationError |
17 | | -from cassandra.cqlengine.query import QueryException |
18 | 17 |
|
19 | | -from tests.integration.cqlengine.base import BaseCassEngTestCase |
20 | 18 | from cassandra.cqlengine.models import Model |
21 | 19 | from cassandra.cqlengine.management import sync_table, drop_table |
22 | 20 | from cassandra.cqlengine import columns |
| 21 | +from tests.integration.cqlengine import is_prepend_reversed |
| 22 | +from tests.integration.cqlengine.base import BaseCassEngTestCase |
23 | 23 |
|
24 | 24 |
|
25 | 25 | class TestQueryUpdateModel(Model): |
@@ -192,13 +192,16 @@ def test_list_prepend_updates(self): |
192 | 192 | """ Prepend two things since order is reversed by default by CQL """ |
193 | 193 | partition = uuid4() |
194 | 194 | cluster = 1 |
| 195 | + original = ["foo"] |
195 | 196 | TestQueryUpdateModel.objects.create( |
196 | | - partition=partition, cluster=cluster, text_list=["foo"]) |
| 197 | + partition=partition, cluster=cluster, text_list=original) |
| 198 | + prepended = ['bar', 'baz'] |
197 | 199 | TestQueryUpdateModel.objects( |
198 | 200 | partition=partition, cluster=cluster).update( |
199 | | - text_list__prepend=['bar', 'baz']) |
| 201 | + text_list__prepend=prepended) |
200 | 202 | obj = TestQueryUpdateModel.objects.get(partition=partition, cluster=cluster) |
201 | | - self.assertEqual(obj.text_list, ["bar", "baz", "foo"]) |
| 203 | + expected = (prepended[::-1] if is_prepend_reversed() else prepended) + original |
| 204 | + self.assertEqual(obj.text_list, expected) |
202 | 205 |
|
203 | 206 | def test_map_update_updates(self): |
204 | 207 | """ Merge a dictionary into existing value """ |
|
0 commit comments