# Path: test/framework/config.py



import os, re, tempfile
from os.path import join as jp
from functools import partial
from jenkinsflow.test import cfg as test_cfg
from jenkinsflow.test.cfg import ApiType
from .config import flow_graph_root_dir
from .lines_in import lines_in as generic_lines_in
        return _http_re.sub(r'http://x.x/job/\1\2', contains_url)
    else:
        return _http_re.sub(r'/tmp/jenkinsflow-test/job/\1.py', contains_url)


def lines_in(api_type, text, *expected_lines):
    """Assert that `*expected_lines` occur in order in the lines of `text`.

    Args:
        *expected_lines (str or RegexObject (hasattr `match`)): For each `expected_line` in expected_lines:
            If `expected_line` has a match method it is called and must return True for a line in `text`.
            Otherwise, if the `expected_line` starts with '^', a line in `text` must start with `expected_line[1:]`
            Otherwise `expected line` must simply occur in a line in `text`
    """

    assert isinstance(api_type, test_cfg.ApiType)
    assert text
    assert expected_lines

    return generic_lines_in(text, partial(replace_host_port, api_type), *expected_lines)


def flow_graph_dir(flow_name):
    """Control which directory to put flow graph in.

    Put the generated graph in the workspace root if running from Jenkins.
    If running from commandline put it under config.flow_graph_root_dir/flow_name

    Return: dir-name
    """

# Path: test/framework/config.py



# Path: test/framework/utils.py
import os, re, tempfile
from os.path import join as jp
from functools import partial
from jenkinsflow.test import cfg as test_cfg
from jenkinsflow.test.cfg import ApiType
from .config import flow_graph_root_dir
from .lines_in import lines_in as generic_lines_in

        return _http_re.sub(r'http://x.x/job/\1\2', contains_url)
    else:
        return _http_re.sub(r'/tmp/jenkinsflow-test/job/\1.py', contains_url)


def lines_in(api_type, text, *expected_lines):
    """Assert that `*expected_lines` occur in order in the lines of `text`.

    Args:
        *expected_lines (str or RegexObject (hasattr `match`)): For each `expected_line` in expected_lines:
            If `expected_line` has a match method it is called and must return True for a line in `text`.
            Otherwise, if the `expected_line` starts with '^', a line in `text` must start with `expected_line[1:]`
            Otherwise `expected line` must simply occur in a line in `text`
    """

    assert isinstance(api_type, test_cfg.ApiType)
    assert text
    assert expected_lines

    return generic_lines_in(text, partial(replace_host_port, api_type), *expected_lines)


def flow_graph_dir(flow_name):
    """Control which directory to put flow graph in.

    Put the generated graph in the workspace root if running from Jenkins.
    If running from commandline put it under config.flow_graph_root_dir/flow_name

    Return: dir-name
    """

    return '.' if os.environ.get('JOB_NAME') else jp(flow_graph_root_dir, flow_name)