How to use the elasticmock.behaviour.server_failure function in ElasticMock

To help you get started, we’ve selected a few ElasticMock examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vrcmarcos / elasticmock / tests / fake_elasticsearch / behaviour / test_server_failure.py View on Github external
def test_should_return_internal_server_error_when_simulate_server_error_is_true(self):
        behaviour.server_failure.enable()
        data = self.es.index(index=INDEX_NAME, doc_type=DOC_TYPE, body=BODY)

        expected = {
            'status_code': 500,
            'error': 'Internal Server Error'
        }

        self.assertDictEqual(expected, data)
github vrcmarcos / elasticmock / tests / test_elasticmock.py View on Github external
def test_should_return_internal_server_error_when_simulate_server_error_is_true(self):
        behaviour.server_failure.enable()
        data = self.es.index(index=self.index_name, doc_type=self.doc_type, body=self.body)

        expected = {
            'status_code': 500,
            'error': 'Internal Server Error'
        }

        self.assertDictEqual(expected, data)