# Path: test/framework/abstract_api.py
# class AbstractApiJob(metaclass=abc.ABCMeta):
#     @abc.abstractmethod
#     def invoke(self, securitytoken, build_params, cause, description):
#         raise Exception("AbstractNotImplemented")
# 
#     # The following should be declare abstract, but since they are 'implemented' by proxy we can't do that (conveniently)
#     # def is_running(self):
#     # def is_queued(self):
#     # def get_last_build_or_none(self):
#     # def get_build_triggerurl(self):
#     # def update_config(self, config_xml):
#     # def poll(self):
# 
# class AbstractApiJenkins(metaclass=abc.ABCMeta):
#     @abc.abstractmethod
#     def create_job(self, job_name, config_xml):
#         raise Exception("AbstractNotImplemented")
# 
#     @abc.abstractmethod
#     def delete_job(self, job_name):
#         raise Exception("AbstractNotImplemented")
# 
#     @abc.abstractmethod
#     def get_job(self, name):
#         raise Exception("AbstractNotImplemented")
# 
#     @abc.abstractmethod
#     def poll(self):
#         raise Exception("AbstractNotImplemented")
# 
# Path: test/framework/config.py



import abc
import os
from collections import OrderedDict
from os.path import join as jp
from jenkinsflow.api_base import UnknownJobException, BuildResult, Progress
from .abstract_api import AbstractApiJob, AbstractApiJenkins
from .config import test_tmp_dir
        try:
            job = self.test_jobs[job_name]
            if job.non_existing:
                raise UnknownJobException(job_name)
            job.non_existing = True
        except KeyError as ex:
            raise Exception("Test job setup error, missing test job definition:", job_name) from ex

    def create_job(self, job_name, config_xml):
        try:
            job = self.test_jobs[job_name]
            job.non_existing = False
        except KeyError as ex:
            raise Exception("Test job setup error, missing test job definition:", job_name) from ex

    def job_creator(self):
        return Jobs(self)

    @abc.abstractmethod
    def flow_job(self, name=None, params=None):
        pass

    def flow_job_name(self, name):
        # Don't create flow jobs when mocked
        name = '0flow_' + name if name else '0flow'
        return (self.job_name_prefix or '') + name

    def __enter__(self):
        # pylint: disable=attribute-defined-outside-init
        self._pre_work_dir = os.getcwd()

# Path: test/framework/abstract_api.py
# class AbstractApiJob(metaclass=abc.ABCMeta):
#     @abc.abstractmethod
#     def invoke(self, securitytoken, build_params, cause, description):
#         raise Exception("AbstractNotImplemented")
# 
#     # The following should be declare abstract, but since they are 'implemented' by proxy we can't do that (conveniently)
#     # def is_running(self):
#     # def is_queued(self):
#     # def get_last_build_or_none(self):
#     # def get_build_triggerurl(self):
#     # def update_config(self, config_xml):
#     # def poll(self):
# 
# class AbstractApiJenkins(metaclass=abc.ABCMeta):
#     @abc.abstractmethod
#     def create_job(self, job_name, config_xml):
#         raise Exception("AbstractNotImplemented")
# 
#     @abc.abstractmethod
#     def delete_job(self, job_name):
#         raise Exception("AbstractNotImplemented")
# 
#     @abc.abstractmethod
#     def get_job(self, name):
#         raise Exception("AbstractNotImplemented")
# 
#     @abc.abstractmethod
#     def poll(self):
#         raise Exception("AbstractNotImplemented")
# 
# Path: test/framework/config.py



# Path: test/framework/base_test_api.py
import abc
import os
from collections import OrderedDict
from os.path import join as jp
from jenkinsflow.api_base import UnknownJobException, BuildResult, Progress
from .abstract_api import AbstractApiJob, AbstractApiJenkins
from .config import test_tmp_dir

        try:
            job = self.test_jobs[job_name]
            if job.non_existing:
                raise UnknownJobException(job_name)
            job.non_existing = True
        except KeyError as ex:
            raise Exception("Test job setup error, missing test job definition:", job_name) from ex

    def create_job(self, job_name, config_xml):
        try:
            job = self.test_jobs[job_name]
            job.non_existing = False
        except KeyError as ex:
            raise Exception("Test job setup error, missing test job definition:", job_name) from ex

    def job_creator(self):
        return Jobs(self)

    @abc.abstractmethod
    def flow_job(self, name=None, params=None):
        pass

    def flow_job_name(self, name):
        # Don't create flow jobs when mocked
        name = '0flow_' + name if name else '0flow'
        return (self.job_name_prefix or '') + name

    def __enter__(self):
        # pylint: disable=attribute-defined-outside-init
        self._pre_work_dir = os.getcwd()

        self._work_dir = jp(test_tmp_dir,self.job_name_prefix)