Updates the prepend to list test to make sure order is preserved when

multiple items are prepended
This commit is contained in:
Danny Cosson
2014-02-10 10:15:52 -05:00
parent 57f92c0777
commit e11f53e370

View File

@@ -173,12 +173,13 @@ class QueryUpdateTests(BaseCassEngTestCase):
self.assertEqual(obj.text_list, ["foo", "bar"])
def test_list_prepend_updates(self):
""" Prepend two things since order is reversed by default by CQL """
partition = uuid4()
cluster = 1
TestQueryUpdateModel.objects.create(
partition=partition, cluster=cluster, text_list=["foo"])
TestQueryUpdateModel.objects(
partition=partition, cluster=cluster).update(
text_list__prepend=['bar'])
text_list__prepend=['bar', 'baz'])
obj = TestQueryUpdateModel.objects.get(partition=partition, cluster=cluster)
self.assertEqual(obj.text_list, ["bar", "foo"])
self.assertEqual(obj.text_list, ["bar", "baz", "foo"])