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 — pip_8.1.2 ( 36f804 )
by
unknown
06:44
created

test_rendering_http_request()   A

Complexity

Conditions 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
1
import json
2
import mock
3
4
from st2tests.base import BaseActionTestCase
5
6
from format_execution_result import FormatResultAction
7
8
__all__ = [
9
    'FormatResultActionTestCase'
10
]
11
12
13
class FormatResultActionTestCase(BaseActionTestCase):
14
    action_cls = FormatResultAction
15
16
    def test_rendering_works_remote_shell_cmd(self):
17
        remote_shell_cmd_execution_model = json.loads(
18
            self.get_fixture_content('remote_cmd_execution.json')
19
        )
20
21
        action = self.get_action_instance()
22
        action._get_execution = mock.MagicMock(
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like _get_execution was declared protected and should not be accessed from this context.

Prefixing a member variable _ is usually regarded as the equivalent of declaring it with protected visibility that exists in other languages. Consequentially, such a member should only be accessed from the same class or a child class:

class MyParent:
    def __init__(self):
        self._x = 1;
        self.y = 2;

class MyChild(MyParent):
    def some_method(self):
        return self._x    # Ok, since accessed from a child class

class AnotherClass:
    def some_method(self, instance_of_my_child):
        return instance_of_my_child._x   # Would be flagged as AnotherClass is not
                                         # a child class of MyParent
Loading history...
23
            return_value=remote_shell_cmd_execution_model
24
        )
25
        self.assertTrue(action.run(execution_id='57967f9355fc8c19a96d9e4f'))
26
27
    def test_rendering_local_shell_cmd(self):
28
        local_shell_cmd_execution_model = json.loads(
29
            self.get_fixture_content('local_cmd_execution.json')
30
        )
31
32
        action = self.get_action_instance()
33
        action._get_execution = mock.MagicMock(
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like _get_execution was declared protected and should not be accessed from this context.

Prefixing a member variable _ is usually regarded as the equivalent of declaring it with protected visibility that exists in other languages. Consequentially, such a member should only be accessed from the same class or a child class:

class MyParent:
    def __init__(self):
        self._x = 1;
        self.y = 2;

class MyChild(MyParent):
    def some_method(self):
        return self._x    # Ok, since accessed from a child class

class AnotherClass:
    def some_method(self, instance_of_my_child):
        return instance_of_my_child._x   # Would be flagged as AnotherClass is not
                                         # a child class of MyParent
Loading history...
34
            return_value=local_shell_cmd_execution_model
35
        )
36
        self.assertTrue(action.run(execution_id='5799522f55fc8c2d33ac03e0'))
37
38
    def test_rendering_http_request(self):
39
        http_execution_model = json.loads(
40
            self.get_fixture_content('http_execution.json')
41
        )
42
43
        action = self.get_action_instance()
44
        action._get_execution = mock.MagicMock(
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like _get_execution was declared protected and should not be accessed from this context.

Prefixing a member variable _ is usually regarded as the equivalent of declaring it with protected visibility that exists in other languages. Consequentially, such a member should only be accessed from the same class or a child class:

class MyParent:
    def __init__(self):
        self._x = 1;
        self.y = 2;

class MyChild(MyParent):
    def some_method(self):
        return self._x    # Ok, since accessed from a child class

class AnotherClass:
    def some_method(self, instance_of_my_child):
        return instance_of_my_child._x   # Would be flagged as AnotherClass is not
                                         # a child class of MyParent
Loading history...
45
            return_value=http_execution_model
46
        )
47
        self.assertTrue(action.run(execution_id='579955f055fc8c2d33ac03e3'))
48
49
    def test_rendering_python_action(self):
50
        python_action_execution_model = json.loads(
51
            self.get_fixture_content('python_action_execution.json')
52
        )
53
54
        action = self.get_action_instance()
55
        action._get_execution = mock.MagicMock(
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like _get_execution was declared protected and should not be accessed from this context.

Prefixing a member variable _ is usually regarded as the equivalent of declaring it with protected visibility that exists in other languages. Consequentially, such a member should only be accessed from the same class or a child class:

class MyParent:
    def __init__(self):
        self._x = 1;
        self.y = 2;

class MyChild(MyParent):
    def some_method(self):
        return self._x    # Ok, since accessed from a child class

class AnotherClass:
    def some_method(self, instance_of_my_child):
        return instance_of_my_child._x   # Would be flagged as AnotherClass is not
                                         # a child class of MyParent
Loading history...
56
            return_value=python_action_execution_model
57
        )
58
        self.assertTrue(action.run(execution_id='5799572a55fc8c2d33ac03ec'))
59