

@mock.patch('nailgun.api.v1.handlers.logs.DumpTaskManager')
def test_log_package_handler_with_dump_task_manager_error(self, dump_manager):
    '400 status when errors with uncompleted models in session occur'

    def dump_task_with_bad_model(*args, **kwargs):
        raise errors.TaskAlreadyRunning()
    dump_manager().execute.side_effect = dump_task_with_bad_model
    resp = self.app.put(reverse('LogPackageHandler'), '[]', headers=self.default_headers, expect_errors=True)
    self.assertEqual(resp.status_code, 400)

dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/test/unit/test_logs_handlers.py TestLogs.test_log_package_handler_with_dump_task_manager_error/original