

def test_log_package_handler_failed(self):
    tm_patcher = mock.patch('nailgun.api.v1.handlers.logs.DumpTaskManager')
    tm_mocked = tm_patcher.start()
    tm_instance = tm_mocked.return_value

    def raiser():
        raise Exception()
    tm_instance.execute.side_effect = raiser
    resp = self.app.put(reverse('LogPackageHandler'), '[]', headers=self.default_headers, expect_errors=True)
    tm_patcher.stop()
    self.assertEqual(self.status_code, 400)

dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/test/unit/test_logs_handlers.py TestLogs.test_log_package_handler_failed/VarMisuse@91/141 `resp`->`self`