# Path: freezer_api/api/v2/jobs.py
# class JobsBaseResource(resource.BaseResource):
# class JobsCollectionResource(JobsBaseResource):
# class JobsResource(JobsBaseResource):
# class JobsEvent(resource.BaseResource):
# class Action(object):
# class Job(object):
#     def __init__(self, storage_driver):
#     def get_action(self, project_id, user_id, action_id):
#     def update_actions_in_job(self, project_id, user_id, job_doc):
#     def on_get(self, req, resp, project_id):
#     def on_post(self, req, resp, project_id):
#     def on_get(self, req, resp, project_id, job_id):
#     def on_delete(self, req, resp, project_id, job_id):
#     def on_patch(self, req, resp, project_id, job_id):
#     def on_post(self, req, resp, project_id, job_id):
#     def __init__(self, storage_driver):
#     def on_post(self, req, resp, project_id, job_id):
#     def __init__(self, doc):
#     def action_id(self):
#     def action_id(self, value):
#     def create_new_action_id(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __init__(self, doc):
#     def execute_event(self, event, params):
#     def job_status(self):
#     def job_status(self, value):
#     def start(self, params=None):
#     def stop(self, params=None):
#     def abort(self, params=None):
#     def actions(self):
#     def expand_default_properties(self):
# 
# Path: freezer_api/common/exceptions.py
# class FreezerAPIException(falcon.HTTPError):
# class BadDataFormat(FreezerAPIException):
# class DocumentExists(FreezerAPIException):
# class StorageEngineError(FreezerAPIException):
# class DocumentNotFound(FreezerAPIException):
# class AccessForbidden(FreezerAPIException):
# class MethodNotImplemented(FreezerAPIException):
#     def __init__(self, message=''):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
# 
# Path: freezer_api/tests/unit/common.py
# CONF = cfg.CONF
# def get_fake_backup_metadata():
# def get_fake_job_0():
# def get_fake_job_1():
# def get_fake_job_2():
# def get_fake_job_3():
# def get_fake_job_id():
# def get_fake_client_0():
# def get_fake_client_1():
# def get_fake_client_id():
# def get_fake_action_0():
# def get_fake_action_1():
# def get_fake_action_2():
# def get_fake_action_id():
# def get_fake_action_3():
# def get_fake_session_0():
# def get_fake_session_1():
# def get_fake_session_2():
# def get_fake_session_3():
# def get_fake_session_id():
#     def __init__(self, method='GET', body=''):
#     def get_header(self, key):
#     def setUp(self):
#     def __init__(self, *args, **kwargs):
#     def to_dict(self):
# def get_req_items(name):
# class FakeReqResp(object):
# class FreezerBaseTestCase(testtools.TestCase):
# class FakeContext(object):


import random
import falcon
from unittest import mock
from unittest.mock import patch
from oslo_serialization import jsonutils as json
from freezer_api.api.v2 import jobs as v2_jobs
from freezer_api.common import exceptions
from freezer_api.tests.unit import common
                   }

        found_action = {
            "action_id": "ottonero",
            "freezer_action": {
                "mode": "mysql",
                "container": "different_drum"
            },
            "max_retries": 4
        }

        new_doc = action_doc.copy()
        new_doc['action_id'] = ''
        self.resource.get_action.return_value = found_action
        self.resource.update_actions_in_job('tecs', 'duder', job_doc=job_doc)
        self.mock_db.add_action.assert_called_with(project_id='tecs',
                                                   user_id='duder',
                                                   doc=new_doc)


class TestJobsCollectionResource(common.FreezerBaseTestCase):
    def setUp(self):
        super(TestJobsCollectionResource, self).setUp()
        self.mock_json_body = mock.Mock()
        self.mock_json_body.return_value = {}
        self.mock_db = mock.Mock()
        self.mock_req = mock.MagicMock()
        self.mock_req.env.__getitem__.side_effect = common.get_req_items
        self.mock_req.get_header.return_value = common.fake_job_0_user_id
        self.mock_req.status = falcon.HTTP_200

# Path: freezer_api/api/v2/jobs.py
# class JobsBaseResource(resource.BaseResource):
# class JobsCollectionResource(JobsBaseResource):
# class JobsResource(JobsBaseResource):
# class JobsEvent(resource.BaseResource):
# class Action(object):
# class Job(object):
#     def __init__(self, storage_driver):
#     def get_action(self, project_id, user_id, action_id):
#     def update_actions_in_job(self, project_id, user_id, job_doc):
#     def on_get(self, req, resp, project_id):
#     def on_post(self, req, resp, project_id):
#     def on_get(self, req, resp, project_id, job_id):
#     def on_delete(self, req, resp, project_id, job_id):
#     def on_patch(self, req, resp, project_id, job_id):
#     def on_post(self, req, resp, project_id, job_id):
#     def __init__(self, storage_driver):
#     def on_post(self, req, resp, project_id, job_id):
#     def __init__(self, doc):
#     def action_id(self):
#     def action_id(self, value):
#     def create_new_action_id(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __init__(self, doc):
#     def execute_event(self, event, params):
#     def job_status(self):
#     def job_status(self, value):
#     def start(self, params=None):
#     def stop(self, params=None):
#     def abort(self, params=None):
#     def actions(self):
#     def expand_default_properties(self):
# 
# Path: freezer_api/common/exceptions.py
# class FreezerAPIException(falcon.HTTPError):
# class BadDataFormat(FreezerAPIException):
# class DocumentExists(FreezerAPIException):
# class StorageEngineError(FreezerAPIException):
# class DocumentNotFound(FreezerAPIException):
# class AccessForbidden(FreezerAPIException):
# class MethodNotImplemented(FreezerAPIException):
#     def __init__(self, message=''):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
# 
# Path: freezer_api/tests/unit/common.py
# CONF = cfg.CONF
# def get_fake_backup_metadata():
# def get_fake_job_0():
# def get_fake_job_1():
# def get_fake_job_2():
# def get_fake_job_3():
# def get_fake_job_id():
# def get_fake_client_0():
# def get_fake_client_1():
# def get_fake_client_id():
# def get_fake_action_0():
# def get_fake_action_1():
# def get_fake_action_2():
# def get_fake_action_id():
# def get_fake_action_3():
# def get_fake_session_0():
# def get_fake_session_1():
# def get_fake_session_2():
# def get_fake_session_3():
# def get_fake_session_id():
#     def __init__(self, method='GET', body=''):
#     def get_header(self, key):
#     def setUp(self):
#     def __init__(self, *args, **kwargs):
#     def to_dict(self):
# def get_req_items(name):
# class FakeReqResp(object):
# class FreezerBaseTestCase(testtools.TestCase):
# class FakeContext(object):


# Path: freezer_api/tests/unit/v2/test_jobs.py
import random
import falcon
from unittest import mock
from unittest.mock import patch
from oslo_serialization import jsonutils as json
from freezer_api.api.v2 import jobs as v2_jobs
from freezer_api.common import exceptions
from freezer_api.tests.unit import common

                   }

        found_action = {
            "action_id": "ottonero",
            "freezer_action": {
                "mode": "mysql",
                "container": "different_drum"
            },
            "max_retries": 4
        }

        new_doc = action_doc.copy()
        new_doc['action_id'] = ''
        self.resource.get_action.return_value = found_action
        self.resource.update_actions_in_job('tecs', 'duder', job_doc=job_doc)
        self.mock_db.add_action.assert_called_with(project_id='tecs',
                                                   user_id='duder',
                                                   doc=new_doc)


class TestJobsCollectionResource(common.FreezerBaseTestCase):
    def setUp(self):
        super(TestJobsCollectionResource, self).setUp()
        self.mock_json_body = mock.Mock()
        self.mock_json_body.return_value = {}
        self.mock_db = mock.Mock()
        self.mock_req = mock.MagicMock()
        self.mock_req.env.__getitem__.side_effect = common.get_req_items
        self.mock_req.get_header.return_value = common.fake_job_0_user_id
        self.mock_req.status = falcon.HTTP_200

        self.resource = v2_jobs.JobsCollectionResource(self.mock_db)