Created
May 12, 2013 21:08
-
-
Save robfraz/5564935 to your computer and use it in GitHub Desktop.
check bulk insert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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