# Path: mistralclient/api/v2/executions.py
# class Execution(base.Resource):
#     resource_name = 'Execution'
# 
# Path: mistralclient/api/v2/tasks.py
# class Task(base.Resource):
# class TaskManager(base.ResourceManager):
#     def list(self, workflow_execution_id=None, marker='', limit=None,
#              sort_keys='', sort_dirs='', fields=None, **filters):
#     def get(self, id):
#     def get_task_sub_executions(self, id, errors_only='', max_depth=-1):
#     def rerun(self, task_ex_id, reset=True, env=None):
# 
# Path: mistralclient/tests/unit/v2/base.py
# class BaseClientV2Test(base.BaseClientTest):
#     TEST_URL = 'http://mistral.example.com'
#     def setUp(self):


from oslo_serialization import jsonutils
from mistralclient.api.v2.executions import Execution
from mistralclient.api.v2 import tasks
from mistralclient.tests.unit.v2 import base

    def test_rerun_update_env(self):
        url = self.TEST_URL + URL_TEMPLATE_ID % TASK['id']
        self.requests_mock.put(url, json=TASK)

        task = self.tasks.rerun(TASK['id'], env={'k1': 'foobar'})

        self.assertDictEqual(
            tasks.Task(self.tasks, TASK).to_dict(),
            task.to_dict()
        )

        body = {
            'reset': True,
            'state': 'RUNNING',
            'id': TASK['id'],
            'env': jsonutils.dumps({'k1': 'foobar'})
        }
        self.assertDictEqual(body, self.requests_mock.last_request.json())

    def test_get_sub_executions(self):
        url = self.TEST_URL + URL_TEMPLATE_SUB_EXECUTIONS \
              % (TASK['id'], '?max_depth=-1&errors_only=')

        self.requests_mock.get(url, json={'executions': [SUB_WF_EXEC]})

        sub_execution_list = self.tasks.get_task_sub_executions(TASK['id'])

        self.assertEqual(1, len(sub_execution_list))
        self.assertDictEqual(

# Path: mistralclient/api/v2/executions.py
# class Execution(base.Resource):
#     resource_name = 'Execution'
# 
# Path: mistralclient/api/v2/tasks.py
# class Task(base.Resource):
# class TaskManager(base.ResourceManager):
#     def list(self, workflow_execution_id=None, marker='', limit=None,
#              sort_keys='', sort_dirs='', fields=None, **filters):
#     def get(self, id):
#     def get_task_sub_executions(self, id, errors_only='', max_depth=-1):
#     def rerun(self, task_ex_id, reset=True, env=None):
# 
# Path: mistralclient/tests/unit/v2/base.py
# class BaseClientV2Test(base.BaseClientTest):
#     TEST_URL = 'http://mistral.example.com'
#     def setUp(self):


# Path: mistralclient/tests/unit/v2/test_tasks.py
from oslo_serialization import jsonutils
from mistralclient.api.v2.executions import Execution
from mistralclient.api.v2 import tasks
from mistralclient.tests.unit.v2 import base


    def test_rerun_update_env(self):
        url = self.TEST_URL + URL_TEMPLATE_ID % TASK['id']
        self.requests_mock.put(url, json=TASK)

        task = self.tasks.rerun(TASK['id'], env={'k1': 'foobar'})

        self.assertDictEqual(
            tasks.Task(self.tasks, TASK).to_dict(),
            task.to_dict()
        )

        body = {
            'reset': True,
            'state': 'RUNNING',
            'id': TASK['id'],
            'env': jsonutils.dumps({'k1': 'foobar'})
        }
        self.assertDictEqual(body, self.requests_mock.last_request.json())

    def test_get_sub_executions(self):
        url = self.TEST_URL + URL_TEMPLATE_SUB_EXECUTIONS \
              % (TASK['id'], '?max_depth=-1&errors_only=')

        self.requests_mock.get(url, json={'executions': [SUB_WF_EXEC]})

        sub_execution_list = self.tasks.get_task_sub_executions(TASK['id'])

        self.assertEqual(1, len(sub_execution_list))
        self.assertDictEqual(

            Execution(self.executions, SUB_WF_EXEC).to_dict(),