Skip to content

Commit

Permalink
Merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Meredith committed Jul 21, 2010
2 parents 454dbf5 + 63f6640 commit 4e474c4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
6 changes: 3 additions & 3 deletions riak/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def set_r(self, r):
self._r = r
return self

def get_w(self, w):
def get_w(self, w=None):
"""
Get the W-value for this bucket, if it is set, otherwise return
the W-value for the client.
Expand All @@ -85,7 +85,7 @@ def set_w(self, w):
self._w = w
return self

def get_dw(self, dw):
def get_dw(self, dw=None):
"""
Get the DW-value for this bucket, if it is set, otherwise return
the DW-value for the client.
Expand All @@ -106,7 +106,7 @@ def set_dw(self, dw):
self._dw = dw
return self

def get_rw(self, rw):
def get_rw(self, rw=None):
"""
Get the RW-value for this bucket, if it is set, otherwise return
the RW-value for the client.
Expand Down
19 changes: 19 additions & 0 deletions riak/tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,25 @@ def test_set_bucket_properties(self):
self.assertFalse(bucket.get_allow_multiples())
self.assertEqual(bucket.get_n_val(), 2)

def test_rw_settings(self):
bucket = self.client.bucket('rwsettings')
self.assertEqual(bucket.get_r(), "default")
self.assertEqual(bucket.get_w(), "default")
self.assertEqual(bucket.get_dw(), "default")
self.assertEqual(bucket.get_rw(), "default")

bucket.set_w(1)
self.assertEqual(bucket.get_w(), 1)

bucket.set_r("quorum")
self.assertEqual(bucket.get_r(), "quorum")

bucket.set_dw("all")
self.assertEqual(bucket.get_dw(), "all")

bucket.set_rw("one")
self.assertEqual(bucket.get_rw(), "one")

def test_siblings(self):
# Set up the bucket, clear any existing object...
bucket = self.client.bucket('multiBucket')
Expand Down

0 comments on commit 4e474c4

Please sign in to comment.