'Failing API error response from docker should raise exception'

def test_api_failure(self):

    response = Mock(status_code=500, reason='Because')
    self.mocks.configure_mock('docker_client', {'create_container.side_effect': DockerAPIError('Failure    creating    container', response, 'Failure    creating    container')})
    build_env = DockerEnvironment(version=self.version, project=self.project, build={'id': DUMMY_BUILD_ID})
    def _inner():
        with build_env:
            self.fail('Should    not    hit    this')
    self.assertRaises(BuildEnvironmentError, _inner)
    self.assertFalse(self.mocks.api()(DUMMY_BUILD_ID).put.called)
