def test_set_parameters_error(): test_workflow = ArgoWorkflow() test_workflow.body = { 'spec': { 'arguments': { 'parameters': [{ 'name': 'test-param-1', 'value': 'test-value-1' }, { 'name': 'test-param-2' }] } } } with pytest.raises(KeyError): test_workflow.parameters = {'test-param-1': 'new-value'}
def test_parameters(): test_workflow = ArgoWorkflow() test_workflow.body = { 'spec': { 'arguments': { 'parameters': [{ 'name': 'test-param-1', 'value': 'test-value-1' }, { 'name': 'test-param-2', 'value': 'test-value-2' }] } } } assert test_workflow.parameters == { 'test-param-1': 'test-value-1', 'test-param-2': 'test-value-2' }
# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import pytest from unittest.mock import MagicMock, mock_open, patch from typing import List from platform_resources.workflow import ArgoWorkflow workflow_w_two_param = ArgoWorkflow() workflow_w_two_param.body = {'spec': {'arguments': {'parameters': [{'name': 'test-param-1', 'value': 'test-value-1'}, {'name': 'test-param-2', 'value': 'test-value-2'}]}}} workflow_wo_value = ArgoWorkflow() workflow_wo_value.body = {'spec': {'arguments': {'parameters': [{'name': 'test-param-1', 'value': 'test-value-1'}, {'name': 'test-param-2'}]}}} process_template = ''' apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: process-template- spec: entrypoint: process-template templates: {} - name: process-template