Beispiel #1
0
def is_finished(scanid):
    with session_transaction() as session:
        scan = Scan.load_from_ext_id(scanid, session=session)
        if scan.finished() and scan.status != IrmaScanStatus.finished:
            scan.set_status(IrmaScanStatus.finished)
            session.commit()
            # launch flush celery task on brain
            log.debug("scanid: %s calling scan_flush", scan.external_id)
            celery_brain.scan_flush(scan.external_id)
 def test007_scan_flush(self, m_async_call):
     arg = "test"
     result = module.scan_flush(arg)
     m_async_call.assert_called_once_with(self.m_brain_app,
                                          BRAIN_SCAN_TASKS,
                                          "scan_flush",
                                          args=[arg])
     self.assertEqual(result, m_async_call())
 def test007_scan_flush(self, m_async_call):
     arg = "test"
     result = module.scan_flush(arg)
     m_async_call.assert_called_once_with(self.m_brain_app,
                                          BRAIN_SCAN_TASKS,
                                          "scan_flush",
                                          args=[arg])
     self.assertEqual(result, m_async_call())
 def test007_scan_flush(self):
     arg = "test"
     expected = ((self.m_brain_app, "brain.tasks", "scan_flush"),
                 {"args": [arg]})
     with patch("frontend.controllers.braintasks.async_call") as mock:
         result = module.scan_flush(arg)
     self.assertTrue(mock.called)
     self.assertEqual(mock.call_args, expected)
     self.assertEqual(result, mock())