Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 2fb19d7

Browse files
committed
Fixed test to always expect 400
test_get_item_key_slice_start_greater_than_stop should get a 400 bad request for specifying view keys in the wrong order.
1 parent f6989ba commit 2fb19d7

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

tests/unit/result_tests.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -463,22 +463,14 @@ def test_get_item_key_slice_using_start_stop(self):
463463
def test_get_item_key_slice_start_greater_than_stop(self):
464464
"""
465465
Test getting a key slice by using start value greater than stop value.
466-
The behavior when using CouchDB is to return an HTTP 400 Bad Request
467-
error whereas with Cloudant an empty result collection is returned.
468-
Unfortunately a 400 response cannot definitively be attributed to a
469-
startkey value being greater than an endkey value so the decision to
470-
leave this CouchDB/Cloudant behavior inconsistency as is. We have an
471-
"if-else" branch as part of the test to handle the two differing
472-
behaviors.
466+
The behavior when using CouchDB and newer versions of Cloudant
467+
is to return an HTTP 400 Bad Request.
473468
"""
474469
result = Result(self.view001)
475-
if os.environ.get('RUN_CLOUDANT_TESTS') is None:
476-
with self.assertRaises(HTTPError) as cm:
477-
invalid_result = result['foo': 'bar']
478-
self.assertTrue(
479-
str(cm.exception).startswith('400 Client Error: Bad Request'))
480-
else:
481-
self.assertEqual(result['foo': 'bar'], [])
470+
with self.assertRaises(HTTPError) as cm:
471+
invalid_result = result['foo': 'bar']
472+
self.assertTrue(
473+
str(cm.exception).startswith('400 Client Error: Bad Request'))
482474

483475
def test_get_item_key_slice_using_start_only(self):
484476
"""

0 commit comments

Comments
 (0)