Пример #1
0
def test_run_in_background(mocks: Mocks, context: yogi.Context):
    """Checks the run_in_background() function in the error-free case"""
    def fn(context):
        assert context == 1234
        return yogi.ErrorCode.OK

    mocks.MOCK_ContextRunInBackground(fn)
    context.run_in_background()
Пример #2
0
def test_run_in_background_error(mocks: Mocks, context: yogi.Context):
    """Checks the run_in_background() function in the error case"""
    mocks.MOCK_ContextRunInBackground(
        lambda *_: yogi.ErrorCode.WRONG_OBJECT_TYPE)
    with pytest.raises(yogi.FailureException):
        context.run_in_background()