GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 7ca9c2...d7a396 )
by
unknown
06:26
created

ExceptionHandlingTest.test_bad_task_transition()   A

Complexity

Conditions 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
dl 0
loc 11
rs 9.4285
c 1
b 0
f 0
1
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
2
# contributor license agreements.  See the NOTICE file distributed with
3
# this work for additional information regarding copyright ownership.
4
# The ASF licenses this file to You under the Apache License, Version 2.0
5
# (the "License"); you may not use this file except in compliance with
6
# the License.  You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
16
from integration.mistral import base
17
18
19
class ExceptionHandlingTest(base.TestWorkflowExecution):
20
21
    def test_bad_workflow(self):
22
        with self.assertRaises(Exception) as t:
23
            self._execute_workflow('examples.mistral-foobar', {})
24
25
        self.assertIn('Action "examples.mistral-foobar" cannot be found', t.exception.message)
26
27
    def test_bad_action(self):
28
        execution = self._execute_workflow('examples.mistral-error-bad-action', {})
29
        execution = self._wait_for_completion(execution)
30
        self._assert_failure(execution)
31
        self.assertIn('Failed to find action', execution.result['extra']['state_info'])
32
33
    def test_bad_wf_arg(self):
34
        execution = self._execute_workflow('examples.mistral-error-bad-wf-arg', {})
35
36
        execution = self._wait_for_completion(
37
            execution,
38
            expect_tasks=False,
39
            expect_tasks_completed=False
40
        )
41
42
        self._assert_failure(execution, expect_tasks_failure=False)
43
        self.assertIn('Invalid input', execution.result['extra']['state_info'])
44
45
    def test_bad_task_transition(self):
46
        execution = self._execute_workflow('examples.mistral-error-bad-task-transition', {})
47
48
        execution = self._wait_for_completion(
49
            execution,
50
            expect_tasks=False,
51
            expect_tasks_completed=False
52
        )
53
54
        self._assert_failure(execution, expect_tasks_failure=False)
55
        self.assertIn("Task 'task3' not found", execution.result['error'])
56
57
    def test_bad_with_items(self):
58
        execution = self._execute_workflow('examples.mistral-error-bad-with-items', {})
59
        execution = self._wait_for_completion(execution, expect_tasks=False)
60
        self._assert_failure(execution, expect_tasks_failure=False)
61
        self.assertIn('Wrong input format', execution.result['extra']['state_info'])
62
63
    def test_bad_expr_yaql(self):
64
        execution = self._execute_workflow('examples.mistral-test-yaql-bad-expr', {})
65
        execution = self._wait_for_completion(execution)
66
        self._assert_failure(execution, expect_tasks_failure=False)
67
        self.assertIn('Can not evaluate YAQL expression', execution.result['extra']['state_info'])
68
69
    def test_bad_publish_yaql(self):
70
        execution = self._execute_workflow('examples.mistral-test-yaql-bad-publish', {})
71
        execution = self._wait_for_completion(execution)
72
        self._assert_failure(execution, expect_tasks_failure=False)
73
        self.assertIn('Can not evaluate YAQL expression', execution.result['extra']['state_info'])
74
75
    def test_bad_subworkflow_input_yaql(self):
76
        execution = self._execute_workflow('examples.mistral-test-yaql-bad-subworkflow-input', {})
77
        execution = self._wait_for_completion(execution)
78
        self._assert_failure(execution, expect_tasks_failure=False)
79
        self.assertIn('Can not evaluate YAQL expression', execution.result['extra']['state_info'])
80
81
    def test_bad_task_transition_yaql(self):
82
        execution = self._execute_workflow('examples.mistral-test-yaql-bad-task-transition', {})
83
        execution = self._wait_for_completion(execution)
84
        self._assert_failure(execution, expect_tasks_failure=False)
85
        self.assertIn('Can not evaluate YAQL expression', execution.result['extra']['state_info'])
86
87
    def test_bad_with_items_yaql(self):
88
        execution = self._execute_workflow('examples.mistral-test-yaql-bad-with-items', {})
89
        execution = self._wait_for_completion(execution, expect_tasks=False)
90
        self._assert_failure(execution, expect_tasks_failure=False)
91
        self.assertIn('Can not evaluate YAQL expression', execution.result['extra']['state_info'])
92
93
    def test_bad_expr_jinja(self):
94
        execution = self._execute_workflow('examples.mistral-test-jinja-bad-expr', {})
95
        execution = self._wait_for_completion(execution, expect_tasks=False)
96
        self._assert_failure(execution, expect_tasks_failure=False)
97
98
        # TODO: Currently, Mistral returns "UndefinedError ContextView object has no attribute".
99
        # Need to fix Mistral to return "Cannot evaulate Jinja expression."
100
        # self.assertIn('Can not evaluate Jinja expression',
101
        # execution.result['extra']['state_info'])
102
103
    def test_bad_publish_jinja(self):
104
        execution = self._execute_workflow('examples.mistral-test-jinja-bad-publish', {})
105
        execution = self._wait_for_completion(execution)
106
        self._assert_failure(execution, expect_tasks_failure=False)
107
        self.assertIn('Can not evaluate Jinja expression', execution.result['extra']['state_info'])
108
109
    def test_bad_subworkflow_input_jinja(self):
110
        execution = self._execute_workflow('examples.mistral-test-jinja-bad-subworkflow-input', {})
111
        execution = self._wait_for_completion(execution)
112
        self._assert_failure(execution, expect_tasks_failure=False)
113
        self.assertIn('Can not evaluate Jinja expression', execution.result['extra']['state_info'])
114
115
    def test_bad_task_transition_jinja(self):
116
        execution = self._execute_workflow('examples.mistral-test-jinja-bad-task-transition', {})
117
        execution = self._wait_for_completion(execution)
118
        self._assert_failure(execution, expect_tasks_failure=False)
119
        self.assertIn('Can not evaluate Jinja expression', execution.result['extra']['state_info'])
120
121
    def test_bad_with_items_jinja(self):
122
        execution = self._execute_workflow('examples.mistral-test-jinja-bad-with-items', {})
123
        execution = self._wait_for_completion(execution, expect_tasks=False)
124
        self._assert_failure(execution, expect_tasks_failure=False)
125
        self.assertIn('Can not evaluate Jinja expression', execution.result['extra']['state_info'])
126