Debian Codegraph @

tests/unit/xtriggers/test_echo.py

raw
1 # THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
2 # Copyright (C) NIWA & British Crown (Met Office) & Contributors.
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 from cylc.flow.exceptions import WorkflowConfigError
18 from cylc.flow.xtriggers.echo import validate
19 import pytest
20 from pytest import param
21
22
23 def test_validate_good():
24 validate({
25 'args': (),
26 'kwargs': {'succeed': False, 'egg': 'fried', 'potato': 'baked'}
27 })
28
29
30 @pytest.mark.parametrize(
31 'all_args',
32 (
33 param({'args': (False,), 'kwargs': {}}, id='no-kwarg'),
34 param(
35 {'args': (), 'kwargs': {'spud': 'mashed'}}, id='no-succeed-kwarg'
36 ),
37 ),
38 )
39 def test_validate_exceptions(all_args):
40 with pytest.raises(WorkflowConfigError, match='^Requires'):
41 validate(all_args)