Ejemplo n.º 1
0
def test_loop_config(app, task_workbench):
    """Test the loop config.

    """
    plugin = task_workbench.get_plugin('ecpy.tasks')

    config = LoopTaskConfig(manager=plugin,
                            task_class=plugin.get_task('LoopTask'))

    assert config.task_name
    assert config.ready
    assert config.task_doc

    config.task_name = ''
    assert not config.ready

    config.task_name = 'Test'
    task = config.build_task()
    assert task.name == 'Test'

    plugin.auto_task_names = []
    config = LoopTaskConfig(manager=plugin,
                            task_class=plugin.get_task('LoopTask'))

    assert not config.task_name
    assert not config.ready

    show_and_close_widget(LoopConfigView(config=config))
Ejemplo n.º 2
0
def test_loop_config(app, task_workbench):
    """Test the loop config.

    """
    plugin = task_workbench.get_plugin('ecpy.tasks')

    config = LoopTaskConfig(manager=plugin,
                            task_class=plugin.get_task('ecpy.LoopTask'))

    assert config.task_name
    assert config.ready
    assert config.task_doc

    config.task_name = ''
    assert not config.ready

    config.task_name = 'Test'
    task = config.build_task()
    assert task.name == 'Test'

    plugin.auto_task_names = []
    config = LoopTaskConfig(manager=plugin,
                            task_class=plugin.get_task('ecpy.LoopTask'))

    assert not config.task_name
    assert not config.ready

    show_and_close_widget(LoopConfigView(config=config))
Ejemplo n.º 3
0
def test_loop_config_with_subtask(task_workbench, windows):
    """Test the loop config.

    """
    from ....conftest import DIALOG_SLEEP
    plugin = task_workbench.get_plugin('ecpy.tasks')

    config = LoopTaskConfig(manager=plugin,
                            task_class=plugin.get_task('LoopTask'),
                            task_name='Test')

    show_widget(LoopConfigView(config=config))
    assert config.ready
    sleep(DIALOG_SLEEP)

    config.use_subtask = True
    assert not config.ready
    process_app_events()
    sleep(DIALOG_SLEEP)

    config.subtask = 'BreakTask'
    assert config.ready
    process_app_events()
    sleep(DIALOG_SLEEP)

    config.subconfig.task_name = ''
    assert not config.ready
    process_app_events()
    sleep(DIALOG_SLEEP)

    config.use_subtask = False
    assert config.ready
    process_app_events()
    sleep(DIALOG_SLEEP)

    config.use_subtask = True
    config.subtask = 'ContinueTask'
    task = config.build_task()
    assert task.name == 'Test'
    assert type(task.task).__name__ == 'ContinueTask'
Ejemplo n.º 4
0
def test_loop_config_with_subtask(task_workbench, windows, dialog_sleep):
    """Test the loop config.

    """
    plugin = task_workbench.get_plugin('ecpy.tasks')

    config = LoopTaskConfig(manager=plugin,
                            task_class=plugin.get_task('ecpy.LoopTask'),
                            task_name='Test')

    show_widget(LoopConfigView(config=config))
    assert config.ready
    sleep(dialog_sleep)

    config.use_subtask = True
    assert not config.ready
    process_app_events()
    sleep(dialog_sleep)

    config.subtask = 'ecpy.BreakTask'
    assert config.ready
    process_app_events()
    sleep(dialog_sleep)

    config.subconfig.task_name = ''
    assert not config.ready
    process_app_events()
    sleep(dialog_sleep)

    config.use_subtask = False
    assert config.ready
    process_app_events()
    sleep(dialog_sleep)

    config.use_subtask = True
    config.subtask = 'ecpy.ContinueTask'
    task = config.build_task()
    assert task.name == 'Test'
    assert type(task.task).__name__ == 'ContinueTask'
Ejemplo n.º 5
0
def test_loop_config_with_subtask(task_workbench, windows, dialog_sleep):
    """Test the loop config.

    """
    plugin = task_workbench.get_plugin("ecpy.tasks")

    config = LoopTaskConfig(manager=plugin, task_class=plugin.get_task("ecpy.LoopTask"), task_name="Test")

    show_widget(LoopConfigView(config=config))
    assert config.ready
    sleep(dialog_sleep)

    config.use_subtask = True
    assert not config.ready
    process_app_events()
    sleep(dialog_sleep)

    config.subtask = "ecpy.BreakTask"
    assert config.ready
    process_app_events()
    sleep(dialog_sleep)

    config.subconfig.task_name = ""
    assert not config.ready
    process_app_events()
    sleep(dialog_sleep)

    config.use_subtask = False
    assert config.ready
    process_app_events()
    sleep(dialog_sleep)

    config.use_subtask = True
    config.subtask = "ecpy.ContinueTask"
    task = config.build_task()
    assert task.name == "Test"
    assert type(task.task).__name__ == "ContinueTask"