示例#1
0
def api_env(example_report):
    """
    Set up and yield a client object for the API and the interactive handler.
    """
    mock_target = mock.MagicMock()
    mock_target.cfg.name = "Interactive API Test"

    ihandler = base.TestRunnerIHandler(target=mock_target)
    ihandler.report = example_report
    ihandler.run_all_tests = mock.MagicMock()
    ihandler.run_test = mock.MagicMock()
    ihandler.run_test_suite = mock.MagicMock()
    ihandler.run_test_case = mock.MagicMock()
    ihandler.run_test_case_param = mock.MagicMock()
    ihandler.start_test_resources = mock.MagicMock()
    ihandler.stop_test_resources = mock.MagicMock()

    # Add a couple of fake attachments.
    ihandler.report.attachments = {
        "attached_log.txt": "/path/to/attached_log.txt",
        "attached_image.png": "/path/to/attached_image.png",
    }

    app, _ = http.generate_interactive_api(ihandler)
    app.config["TESTING"] = True

    with app.test_client() as client:
        yield client, ihandler
示例#2
0
def api_env(example_report):
    mock_target = mock.MagicMock()
    mock_target.cfg.name = "Interactive API Test"

    ihandler = base.TestRunnerIHandler(target=mock_target)
    ihandler.report = example_report

    mock_httphandler = mock.MagicMock()

    app, _ = http.generate_interactive_api(mock_httphandler, ihandler)
    app.config["TESTING"] = True

    with app.test_client() as client:
        yield client, mock_httphandler, ihandler
示例#3
0
def api_env(example_report):
    """
    Set up and yield a client object for the API and the interactive handler.
    """
    mock_target = mock.MagicMock()
    mock_target.cfg.name = "Interactive API Test"

    ihandler = base.TestRunnerIHandler(target=mock_target)
    ihandler.report = example_report
    ihandler.run_all_tests = mock.MagicMock()
    ihandler.run_test = mock.MagicMock()
    ihandler.run_test_suite = mock.MagicMock()
    ihandler.run_test_case = mock.MagicMock()
    ihandler.run_test_case_param = mock.MagicMock()
    ihandler.start_test_resources = mock.MagicMock()
    ihandler.stop_test_resources = mock.MagicMock()

    app, _ = http.generate_interactive_api(ihandler)
    app.config["TESTING"] = True

    with app.test_client() as client:
        yield client, ihandler