From c344f1e2742dc49e7d2ea17f4ec5a0632daabef2 Mon Sep 17 00:00:00 2001 From: Danny Cosson Date: Mon, 10 Feb 2014 11:54:31 -0500 Subject: [PATCH] Tries to add a test that doesn't work because of a bug in the underlying cql library. So doing an update with a dict __merge with a None value will not be possible for the time being. --- cqlengine/tests/query/test_updates.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cqlengine/tests/query/test_updates.py b/cqlengine/tests/query/test_updates.py index 723a8e87..592eb285 100644 --- a/cqlengine/tests/query/test_updates.py +++ b/cqlengine/tests/query/test_updates.py @@ -197,3 +197,22 @@ class QueryUpdateTests(BaseCassEngTestCase): text_map__merge={"bar": '3', "baz": '4'}) obj = TestQueryUpdateModel.objects.get(partition=partition, cluster=cluster) self.assertEqual(obj.text_map, {"foo": '1', "bar": '3', "baz": '4'}) + + def test_map_merge_none_deletes_key(self): + """ The CQL behavior is if you set a key in a map to null it deletes + that key from the map. Test that this works with __merge. + + This test fails because of a bug in the cql python library not + converting None to null (and the cql library is no longer in active + developement). + """ + # partition = uuid4() + # cluster = 1 + # TestQueryUpdateModel.objects.create( + # partition=partition, cluster=cluster, + # text_map={"foo": '1', "bar": '2'}) + # TestQueryUpdateModel.objects( + # partition=partition, cluster=cluster).update( + # text_map__merge={"bar": None}) + # obj = TestQueryUpdateModel.objects.get(partition=partition, cluster=cluster) + # self.assertEqual(obj.text_map, {"foo": '1'})