Skip to content

Instantly share code, notes, and snippets.

@robfraz robfraz/gist:5564935
Created May 12, 2013

Embed
What would you like to do?
check bulk insert
def check_bulk_insert(self, response):
# Some basic checks
assert_that(response.status_code, is_(accepted()),
"Bulk docs POST failed")
assert_that(response.json(), is_(instance_of(list)),
"Bulk docs insert didn't return a list")
# Now ensure that none of the individual document inserts had an error.
if type(response.json()) == list:
for insert_result in response.json():
assert_that(insert_result, is_not(has_key("error")),
"Error in a bulk doc insert")
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.