Skip to content

Instantly share code, notes, and snippets.

@robfraz
Created May 12, 2013 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robfraz/5564935 to your computer and use it in GitHub Desktop.
Save robfraz/5564935 to your computer and use it in GitHub Desktop.
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