# 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):


import os, random
from jenkinsflow import jobload
from .framework import api_select
    return job


def test_job_load_new_no_pre_delete(api_type):
    api = api_select.api(__file__, api_type, login=True)
    full_name, short_name = _random_job_name(api)
    api.job(short_name, 1, 1, 1, exec_time=1, non_existing=True)
    jobload.update_job_from_template(api, full_name, api.job_xml_template, pre_delete=False, context=_context)
    _assert_job(api, full_name, cleanup=True)


def test_job_load_new_pre_delete(api_type):
    api = api_select.api(__file__, api_type, login=True)
    full_name, short_name = _random_job_name(api)
    api.job(short_name, 1, 1, 1, exec_time=1, non_existing=True)
    jobload.update_job_from_template(api, full_name, api.job_xml_template, pre_delete=True, context=_context)
    _assert_job(api, full_name, cleanup=True)


def test_job_load_existing_pre_delete(api_type):
    api = api_select.api(__file__, api_type, login=True)
    full_name, short_name = _random_job_name(api)
    api.job(short_name, 1, 1, 1, exec_time=1)
    jobload.update_job_from_template(api, full_name, api.job_xml_template, pre_delete=True, context=_context)
    _assert_job(api, full_name, cleanup=False)
    jobload.update_job_from_template(api, full_name, api.job_xml_template, pre_delete=True, context=_context)
    _assert_job(api, full_name, cleanup=True)


def test_job_load__existing_update(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/job_load_test.py
import os, random
from jenkinsflow import jobload
from .framework import api_select

    return job


def test_job_load_new_no_pre_delete(api_type):
    api = api_select.api(__file__, api_type, login=True)
    full_name, short_name = _random_job_name(api)
    api.job(short_name, 1, 1, 1, exec_time=1, non_existing=True)
    jobload.update_job_from_template(api, full_name, api.job_xml_template, pre_delete=False, context=_context)
    _assert_job(api, full_name, cleanup=True)


def test_job_load_new_pre_delete(api_type):
    api = api_select.api(__file__, api_type, login=True)
    full_name, short_name = _random_job_name(api)
    api.job(short_name, 1, 1, 1, exec_time=1, non_existing=True)
    jobload.update_job_from_template(api, full_name, api.job_xml_template, pre_delete=True, context=_context)
    _assert_job(api, full_name, cleanup=True)


def test_job_load_existing_pre_delete(api_type):
    api = api_select.api(__file__, api_type, login=True)
    full_name, short_name = _random_job_name(api)
    api.job(short_name, 1, 1, 1, exec_time=1)
    jobload.update_job_from_template(api, full_name, api.job_xml_template, pre_delete=True, context=_context)
    _assert_job(api, full_name, cleanup=False)
    jobload.update_job_from_template(api, full_name, api.job_xml_template, pre_delete=True, context=_context)
    _assert_job(api, full_name, cleanup=True)


def test_job_load__existing_update(api_type):

    api = api_select.api(__file__, api_type, login=True)