22import os
33import cPickle
44import copy
5+
56try :
67 import simplejson as json
78except ImportError :
@@ -168,18 +169,21 @@ def test_delete(self):
168169 self .assertFalse (obj .exists )
169170
170171 def test_set_bucket_properties (self ):
171- bucket = self .client .bucket (self .bucket_name )
172+ bucket = self .client .bucket (self .props_bucket )
172173 # Test setting allow mult...
173174 bucket .allow_mult = True
174- self .assertTrue (bucket .allow_mult )
175175 # Test setting nval...
176- bucket .n_val = 3
177- self .assertEqual (bucket .n_val , 3 )
176+ bucket .n_val = 1
177+
178+ bucket2 = self .create_client ().bucket (self .props_bucket )
179+ self .assertTrue (bucket2 .allow_mult )
180+ self .assertEqual (bucket2 .n_val , 1 )
178181 # Test setting multiple properties...
179182 bucket .set_properties ({"allow_mult" : False , "n_val" : 2 })
180183
181- self .assertFalse (bucket .allow_mult )
182- self .assertEqual (bucket .n_val , 2 )
184+ bucket3 = self .create_client ().bucket (self .props_bucket )
185+ self .assertFalse (bucket3 .allow_mult )
186+ self .assertEqual (bucket3 .n_val , 2 )
183187
184188 def test_if_none_match (self ):
185189 bucket = self .client .bucket (self .bucket_name )
@@ -197,9 +201,9 @@ def test_if_none_match(self):
197201
198202 def test_siblings (self ):
199203 # Set up the bucket, clear any existing object...
200- bucket = self .client .bucket (self .bucket_name )
201- bucket .allow_mult = True
204+ bucket = self .client .bucket (self .sibs_bucket )
202205 obj = bucket .get_binary (self .key_name )
206+ bucket .allow_mult = True
203207
204208 # Even if it previously existed, let's store a base resolved version
205209 # from which we can diverge by sending a stale vclock.
@@ -210,7 +214,7 @@ def test_siblings(self):
210214 vals = set ()
211215 for i in range (5 ):
212216 other_client = self .create_client ()
213- other_bucket = other_client .bucket (self .bucket_name )
217+ other_bucket = other_client .bucket (self .sibs_bucket )
214218 while True :
215219 randval = self .randint ()
216220 if randval not in vals :
@@ -223,7 +227,7 @@ def test_siblings(self):
223227
224228 # Make sure the object has itself plus four siblings...
225229 obj .reload ()
226- self .assertTrue (bool (obj .siblings ))
230+ # self.assertTrue(bool(obj.siblings))
227231 self .assertEqual (len (obj .siblings ), 5 )
228232
229233 # Get each of the values - make sure they match what was assigned
@@ -279,7 +283,7 @@ def test_list_buckets(self):
279283
280284class HTTPBucketPropsTest (object ):
281285 def test_rw_settings (self ):
282- bucket = self .client .bucket (self .bucket_name )
286+ bucket = self .client .bucket (self .props_bucket )
283287 self .assertEqual (bucket .r , "quorum" )
284288 self .assertEqual (bucket .w , "quorum" )
285289 self .assertEqual (bucket .dw , "quorum" )
@@ -301,9 +305,10 @@ def test_rw_settings(self):
301305 'r' : 'quorum' ,
302306 'dw' : 'quorum' ,
303307 'rw' : 'quorum' })
308+ bucket .clear_properties ()
304309
305310 def test_primary_quora (self ):
306- bucket = self .client .bucket (self .bucket_name )
311+ bucket = self .client .bucket (self .props_bucket )
307312 self .assertEqual (bucket .pr , 0 )
308313 self .assertEqual (bucket .pw , 0 )
309314
@@ -314,11 +319,12 @@ def test_primary_quora(self):
314319 self .assertEqual (bucket .pw , "quorum" )
315320
316321 bucket .set_properties ({'pr' : 0 , 'pw' : 0 })
322+ bucket .clear_properties ()
317323
318324
319325class PbcBucketPropsTest (object ):
320326 def test_rw_settings (self ):
321- bucket = self .client .bucket ('rwsettings' )
327+ bucket = self .client .bucket (self . props_bucket )
322328 with self .assertRaises (NotImplementedError ):
323329 bucket .r
324330 with self .assertRaises (NotImplementedError ):
@@ -336,9 +342,11 @@ def test_rw_settings(self):
336342 bucket .dw = 2
337343 with self .assertRaises (NotImplementedError ):
338344 bucket .rw = 2
345+ with self .assertRaises (NotImplementedError ):
346+ bucket .clear_properties ()
339347
340348 def test_primary_quora (self ):
341- bucket = self .client .bucket ('primary_quora' )
349+ bucket = self .client .bucket (self . props_bucket )
342350 with self .assertRaises (NotImplementedError ):
343351 bucket .pr
344352 with self .assertRaises (NotImplementedError ):
0 commit comments