Permalink
Browse files

made errors available on ViewResultsIterator. PYCBC-1

Change-Id: If8a23eb6acd99d0ad19c86c13efcd9a0feb9ea46
Reviewed-on: http://review.couchbase.org/20404
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>
Tested-by: Benjamin Young <benjamin@couchbase.com>
  • Loading branch information...
1 parent 4c13e88 commit de22c7579aedd11df05a9ce99320611b0cf7470a @BigBlueHat BigBlueHat committed with Benjamin Young Aug 31, 2012
Showing with 20 additions and 0 deletions.
  1. +1 −0 couchbase/client.py
  2. +19 −0 couchbase/tests/test_client.py
View
@@ -466,6 +466,7 @@ def results(self, params={}):
class ViewResultsIterator(Set):
def __init__(self, results):
self.results = results['rows']
+ self.errors = results.get('errors')
if 'total_rows' in results:
self.total_rows = results['total_rows']
else:
@@ -478,5 +478,24 @@ def test_results(self):
self.teardown_sample_docs()
+class ViewResultsIteratorTest(object):
+ def test_errors_available_on_results(self):
+ """Check that errors are available on View Results. PYCBC-1"""
+ response = {"total_rows": 0,"rows": [],
+ "errors":[{"from": "local",
+ "reason": """Design document
+ `_design/testfoobar` missing in database
+ `test_db_b`."""
+ },
+ {"from": "http://localhost:5984/_view_merge/",
+ "reason": """Design document
+ `_design/testfoobar` missing in database
+ `test_db_c`."""}
+ ]
+ }
+ vr = ViewResultsIterator(response)
+ self.assertIsInstance(vr.errors, types.ListType)
+
+
if __name__ == "__main__":
unittest.main()

0 comments on commit de22c75

Please sign in to comment.