Exemplo n.º 1
0
 def test_old_output_mapping_raises_error(self) -> None:
     op_def = {
         "name": "fake_op",
         "description": "Test",
         "output_mapping": {}
     }
     with pytest.raises(ObsoleteError):
         parser.parse_operation_from_step(op_def)
Exemplo n.º 2
0
 def test_custom_operation_mapping(self) -> None:
     mock_operation = Mock()
     op_def = {"name": "custom"}
     known_ops: parser.OperationMapping = {
         "custom": Mock(return_value=mock_operation)
     }
     op = parser.parse_operation_from_step(op_def, known_ops)
     assert op == mock_operation
Exemplo n.º 3
0
    def test_config_output_mapping_does_not_log(self, logger: Mock) -> None:
        config_dict = {"output_mapping": {"template_variables.name": "name"}}
        op_def = {
            "name": "fake_op",
            "description": "Test",
            "opconfig": config_dict
        }
        op = parser.parse_operation_from_step(op_def)

        opconfig = dict(output_mapping={"template_variables.name": "name"})
        assert op == helpers.FakeOperation(description="Test",
                                           opconfig=opconfig)
        logger.info.assert_not_called()
Exemplo n.º 4
0
 def test_success(self) -> None:
     op_def = {"name": "insert_text", "description": "Test operation"}
     op = parser.parse_operation_from_step(op_def)
     assert op == insert_text.Operation(description="Test operation")
Exemplo n.º 5
0
 def test_operation_with_no_name(self) -> None:
     with pytest.raises(TaskParserError):
         parser.parse_operation_from_step({})
Exemplo n.º 6
0
 def test_unknown_operation(self) -> None:
     with pytest.raises(TaskParserError):
         parser.parse_operation_from_step({"name": "undefined_operation"})