コード例 #1
0
    def test_get(self):
        mock = self.mock_http_get(content=EXEC)

        ex = self.executions.get(EXEC['id'])

        self.assertEqual(
            executions.Execution(self.executions, EXEC).__dict__, ex.__dict__)
        mock.assert_called_once_with(URL_TEMPLATE_ID % EXEC['id'])
コード例 #2
0
    def test_list(self):
        mock = self.mock_http_get(content={'executions': [EXEC]})

        execution_list = self.executions.list()

        self.assertEqual(1, len(execution_list))
        ex = execution_list[0]

        self.assertEqual(
            executions.Execution(self.executions, EXEC).__dict__, ex.__dict__)
        mock.assert_called_once_with(URL_TEMPLATE)
コード例 #3
0
    def test_update(self):
        mock = self.mock_http_put(content=EXEC)
        body = {'state': EXEC['state']}

        ex = self.executions.update(EXEC['id'], EXEC['state'])

        self.assertIsNotNone(ex)
        self.assertEqual(
            executions.Execution(self.executions, EXEC).__dict__, ex.__dict__)
        mock.assert_called_once_with(URL_TEMPLATE_ID % EXEC['id'],
                                     json.dumps(body))
コード例 #4
0
    def test_create(self):
        mock = self.mock_http_post(content=EXEC)
        body = {
            'workflow_name': EXEC['workflow_name'],
            'input': json.dumps(EXEC['input']),
        }

        ex = self.executions.create(EXEC['workflow_name'], EXEC['input'])

        self.assertIsNotNone(ex)
        self.assertEqual(
            executions.Execution(self.executions, EXEC).__dict__, ex.__dict__)
        mock.assert_called_once_with(URL_TEMPLATE, json.dumps(body))
コード例 #5
0
#    License for the specific language governing permissions and limitations
#    under the License.
#

import mock
import pkg_resources as pkg

from highlanderclient.api.v2 import executions
from highlanderclient.commands.v2 import executions as execution_cmd
from highlanderclient.tests.unit import base

EXECUTION = executions.Execution(
    mock, {
        'id': '123',
        'workflow_name': 'some',
        'state': 'RUNNING',
        'state_info': None,
        'created_at': '1',
        'updated_at': '1'
    })


class TestCLIExecutionsV2(base.BaseCommandTest):
    @mock.patch('highlanderclient.api.v2.executions.ExecutionManager.create')
    def test_create_wf_input_string(self, mock):
        mock.return_value = EXECUTION

        result = self.call(execution_cmd.Create,
                           app_args=['id', '{ "context": true }'])

        self.assertEqual(('123', 'some', 'RUNNING', None, '1', '1'), result[1])