def test_is_event_in_progress_true(self): bot = 'test' user = '******' DataImporterLogProcessor.add_log(bot, user, is_data_uploaded=False) assert DataImporterLogProcessor.is_event_in_progress(bot, False) with pytest.raises(AppException): DataImporterLogProcessor.is_event_in_progress(bot)
async def validate_training_data( background_tasks: BackgroundTasks, current_user: User = Depends(auth.get_current_user_and_bot), ): """ Validates bot training data. """ DataImporterLogProcessor.is_limit_exceeded(current_user.get_bot()) DataImporterLogProcessor.is_event_in_progress(current_user.get_bot()) Utility.make_dirs( os.path.join("training_data", current_user.get_bot(), str(datetime.utcnow()))) DataImporterLogProcessor.add_log(current_user.get_bot(), current_user.get_user(), is_data_uploaded=False) background_tasks.add_task(EventsTrigger.trigger_data_importer, current_user.get_bot(), current_user.get_user(), False, False) return {"message": "Event triggered! Check logs."}
def test_is_event_in_progress_false(self): bot = 'test' assert not DataImporterLogProcessor.is_event_in_progress(bot)