Permalink
Browse files

testing cas to prove that PYCBC-23 is fixed

...and to demo how to use cas properly.

Change-Id: Ie0b2c0e9b9352d33cabdb2b6ecaa3300e3762892
Reviewed-on: http://review.couchbase.org/20429
Reviewed-by: Benjamin Young <benjamin@couchbase.com>
Tested-by: Benjamin Young <benjamin@couchbase.com>
  • Loading branch information...
1 parent 24bd252 commit ab31709598f4d6ed068d110cfab8bd80b7c07b0a @BigBlueHat BigBlueHat committed with Benjamin Young Sep 1, 2012
Showing with 20 additions and 0 deletions.
  1. +10 −0 couchbase/tests/test_client.py
  2. +10 −0 couchbase/tests/test_memcachedclient.py
@@ -258,6 +258,16 @@ def test_gat(self):
self.assertTrue(self.client.get(key)[2] == value)
self.client.delete(key)
+ @attr(cbv="1.0.0")
+ def test_cas(self):
+ key = 'test_cas'
+ cas = self.client.set(key, 0, 0, 'testing')[1]
+ self.assertEqual(cas, self.client.get(key)[1])
+ self.client.cas(key, 0, 0, cas, 'testing some more')
+ _, new_cas, value = self.client.get(key)
+ self.assertNotEqual(cas, new_cas)
+ self.assertEqual(value, 'testing some more')
+
@attr(cbv="2.0.0")
def test_save(self):
"""Test deprecated save() method"""
@@ -195,3 +195,13 @@ def test_get_multi(self):
self.assertIn(k, rv)
self.assertEqual(rv[k][2], kv[k])
self.client.delete(k)
+
+ @attr(cbv="1.0.0")
+ def test_cas(self):
+ key = 'test_cas'
+ cas = self.client.set(key, 0, 0, 'testing')[1]
+ self.assertEqual(cas, self.client.get(key)[1])
+ self.client.cas(key, 0, 0, cas, 'testing some more')
+ _, new_cas, value = self.client.get(key)
+ self.assertNotEqual(cas, new_cas)
+ self.assertEqual(value, 'testing some more')

0 comments on commit ab31709

Please sign in to comment.