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
|
|
|
|
15
|
|
|
import yaml |
16
|
|
|
# from mock import MagicMock |
17
|
|
|
|
18
|
|
|
from st2tests.base import BaseActionTestCase |
19
|
|
|
|
20
|
|
|
|
21
|
|
|
class GitHubBaseActionTestCase(BaseActionTestCase): |
22
|
|
|
__test__ = False |
23
|
|
|
|
24
|
|
|
def setUp(self): |
25
|
|
|
super(GitHubBaseActionTestCase, self).setUp() |
26
|
|
|
|
27
|
|
|
self._blank_config = self.load_yaml('blank.yaml') |
28
|
|
|
self._full_config = self.load_yaml('full.yaml') |
29
|
|
|
self._enterprise_default_config = self.load_yaml( |
30
|
|
|
'full-enterprise.yaml') |
31
|
|
|
|
32
|
|
|
def load_yaml(self, filename): |
33
|
|
|
return yaml.safe_load(self.get_fixture_content(filename)) |
34
|
|
|
|
35
|
|
|
@property |
36
|
|
|
def blank_config(self): |
37
|
|
|
return self._blank_config |
38
|
|
|
|
39
|
|
|
@property |
40
|
|
|
def full_config(self): |
41
|
|
|
return self._full_config |
42
|
|
|
|
43
|
|
|
def test_run_no_config(self): |
44
|
|
|
action = self.get_action_instance(self.full_config) |
45
|
|
|
self.assertIsInstance(action, self.action_cls) |
46
|
|
|
|
47
|
|
|
def test_run_is_instance(self): |
48
|
|
|
action = self.get_action_instance(self.full_config) |
49
|
|
|
self.assertIsInstance(action, self.action_cls) |
50
|
|
|
|