示例#1
0
def test_map_app_context(app):
    test_value = random.randint(1, 101)
    iterator = list(range(5))
    app.config['TEST_VALUE'] = test_value
    executor = Executor(app)
    with app.test_request_context(''):
        results = executor.map(app_context_test_value, iterator)
    for r in results:
        assert r == test_value
示例#2
0
def test_map_request_context(app):
    test_value = random.randint(1, 101)
    iterator = list(range(5))
    executor = Executor(app)
    with app.test_request_context('/'):
        request.test_value = test_value
        results = executor.map(request_context_test_value, iterator)
    for r in results:
        assert r == test_value
示例#3
0
def test_map_g_context_process(default_app):
    test_value = random.randint(1, 101)
    iterator = list(range(5))
    executor = Executor(default_app)
    with default_app.test_request_context(''):
        g.test_value = test_value
        results = executor.map(g_context_test_value, iterator)
    for r in results:
        assert r == test_value