# Path: test/framework/api_select.py
# def api(file_name, api_type, login=None, fixed_prefix=None, url_or_dir=None, fake_public_uri=None, invocation_class=None,
#         username=None, password=None):
# 
# Path: test/cfg.py
# class ApiType(Enum):
#     JENKINS = 0
#     SCRIPT = 1
#     MOCK = 2


import sys, os
import subprocess
import pytest
from os.path import join as jp
from pytest import raises
from jenkinsflow.flow import serial
from jenkinsflow.utils.set_build_description import set_build_description
from jenkinsflow.cli.cli import cli
from .framework import api_select
from .framework.cfg import jenkins_security
from . import cfg as test_cfg
from .cfg import ApiType
        api.job('job-7', max_fails=0, expect_invocations=1, expect_order=5, params=_params, serial=True)

        if api.api_type == ApiType.SCRIPT:
            for job_num in range(1, 7):
                job = api.get_job(api.job_name_prefix + 'job-' + str(job_num))
                _clear_description(api, job)

        with serial(api, timeout=70, job_name_prefix=api.job_name_prefix, report_interval=1, description="AAA") as ctrl1:
            ctrl1.invoke('job-1', password='a', s1='b')
            ctrl1.invoke('job-2', password='a', s1='b')

            with ctrl1.parallel(timeout=40, report_interval=3) as ctrl2:
                with ctrl2.serial(timeout=40, report_interval=3) as ctrl3a:
                    ctrl3a.invoke('job-3', password='a', s1='b')
                    ctrl3a.invoke('job-6', password='a', s1='b')

                with ctrl2.parallel(timeout=40, report_interval=3) as ctrl3b:
                    ctrl3b.invoke('job-4', password='a', s1='b')
                    ctrl3b.invoke('job-5', password='a', s1='b')

            ctrl1.invoke('job-7', password='a', s1='b')

        for job_num in range(1, 7):
            job = api.get_job(api.job_name_prefix + 'job-' + str(job_num))
            _, _, build_num = job.job_status()
            assert _get_description(api, job, build_num) == 'AAA'


@pytest.mark.not_apis(ApiType.MOCK)
def test_set_build_description_api(api_type):

# Path: test/framework/api_select.py
# def api(file_name, api_type, login=None, fixed_prefix=None, url_or_dir=None, fake_public_uri=None, invocation_class=None,
#         username=None, password=None):
# 
# Path: test/cfg.py
# class ApiType(Enum):
#     JENKINS = 0
#     SCRIPT = 1
#     MOCK = 2


# Path: test/set_build_description_test.py
import sys, os
import subprocess
import pytest
from os.path import join as jp
from pytest import raises
from jenkinsflow.flow import serial
from jenkinsflow.utils.set_build_description import set_build_description
from jenkinsflow.cli.cli import cli
from .framework import api_select
from .framework.cfg import jenkins_security
from . import cfg as test_cfg
from .cfg import ApiType

        api.job('job-7', max_fails=0, expect_invocations=1, expect_order=5, params=_params, serial=True)

        if api.api_type == ApiType.SCRIPT:
            for job_num in range(1, 7):
                job = api.get_job(api.job_name_prefix + 'job-' + str(job_num))
                _clear_description(api, job)

        with serial(api, timeout=70, job_name_prefix=api.job_name_prefix, report_interval=1, description="AAA") as ctrl1:
            ctrl1.invoke('job-1', password='a', s1='b')
            ctrl1.invoke('job-2', password='a', s1='b')

            with ctrl1.parallel(timeout=40, report_interval=3) as ctrl2:
                with ctrl2.serial(timeout=40, report_interval=3) as ctrl3a:
                    ctrl3a.invoke('job-3', password='a', s1='b')
                    ctrl3a.invoke('job-6', password='a', s1='b')

                with ctrl2.parallel(timeout=40, report_interval=3) as ctrl3b:
                    ctrl3b.invoke('job-4', password='a', s1='b')
                    ctrl3b.invoke('job-5', password='a', s1='b')

            ctrl1.invoke('job-7', password='a', s1='b')

        for job_num in range(1, 7):
            job = api.get_job(api.job_name_prefix + 'job-' + str(job_num))
            _, _, build_num = job.job_status()
            assert _get_description(api, job, build_num) == 'AAA'


@pytest.mark.not_apis(ApiType.MOCK)
def test_set_build_description_api(api_type):

    with api_select.api(__file__, api_type, login=True) as api: