예제 #1
0
파일: test_app.py 프로젝트: stummjr/bottery
def test_app_configure_without_platforms(mocked_settings):
    """Should raise Exception if no platform was found at settings"""

    mocked_settings.PLATFORMS = {}
    app = App()
    with pytest.raises(Exception):
        app.configure_platforms()
예제 #2
0
파일: test_app.py 프로젝트: stummjr/bottery
def test_app_configure_with_tasks(mocked_engine):
    """App should have empty tasks if not defined  on engine"""

    mocked_engine['instance'].tasks.return_value = []
    app = App()
    app.configure_platforms()

    assert not app.tasks
예제 #3
0
def test_app_configure_with_platforms(mocked_engine):
    """Should call the platform interface methods"""

    app = App()
    app.configure_platforms()

    mocked_engine['module'].engine.assert_called_with(
        session=app.session, token='should-be-a-valid-token')
    mocked_engine['instance'].configure.assert_called_with()
예제 #4
0
def test_app_configure_with_multiple_tasks(mocked_engine):
    """App should have multiple tasks if defined on engine"""
    async def fake_task(session):
        await asyncio.sleep(0)

    first_task = fake_task
    second_task = fake_task

    mocked_engine['instance'].tasks = [first_task, second_task]
    app = App()
    app.configure_platforms()

    assert app.tasks == [first_task, second_task]