Test Failed
Pull Request — master (#27)
by George
01:13
created

test_sqs_route_provider_options()   A

Complexity

Conditions 3

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
c 1
b 0
f 0
dl 0
loc 4
rs 10
1
from loafer.ext.aws.message_translators import SQSMessageTranslator, SNSMessageTranslator
2
from loafer.ext.aws.providers import SQSProvider
0 ignored issues
show
Bug introduced by
The name providers does not seem to exist in module loafer.ext.aws.
Loading history...
Configuration introduced by
Unable to import 'loafer.ext.aws.providers' (invalid syntax (<string>, line 22))

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
3
from loafer.ext.aws.routes import SQSRoute, SNSQueueRoute
4
5
6
def test_sqs_route(dummy_handler):
7
    route = SQSRoute('what', handler=dummy_handler)
8
    assert isinstance(route.message_translator, SQSMessageTranslator)
0 ignored issues
show
Bug introduced by
The Instance of SQSRoute does not seem to have a member named message_translator.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
9
    assert isinstance(route.provider, SQSProvider)
0 ignored issues
show
Bug introduced by
The Instance of SQSRoute does not seem to have a member named provider.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
10
    assert route.name == 'what'
0 ignored issues
show
Bug introduced by
The Instance of SQSRoute does not seem to have a member named name.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
11
12
13
def test_sqs_route_keep_message_translator(dummy_handler):
0 ignored issues
show
Coding Style Naming introduced by
The name test_sqs_route_keep_message_translator does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
14
    route = SQSRoute('what', handler=dummy_handler, message_translator=SNSMessageTranslator())
15
    assert isinstance(route.message_translator, SNSMessageTranslator)
0 ignored issues
show
Bug introduced by
The Instance of SQSRoute does not seem to have a member named message_translator.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
16
    route = SQSRoute('what', handler=dummy_handler, message_translator=None)
17
    assert route.message_translator is None
0 ignored issues
show
Bug introduced by
The Instance of SQSRoute does not seem to have a member named message_translator.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
18
19
20
def test_sqs_route_keep_name(dummy_handler):
21
    route = SQSRoute('what', handler=dummy_handler, name='foobar')
22
    assert route.name == 'foobar'
0 ignored issues
show
Bug introduced by
The Instance of SQSRoute does not seem to have a member named name.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
23
24
25
def test_sqs_route_provider_options(dummy_handler):
26
    route = SQSRoute('what', {'use_ssl': False}, handler=dummy_handler, name='foobar')
27
    assert 'use_ssl' in route.provider._client_options
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like _client_options 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...
Bug introduced by
The Instance of SQSRoute does not seem to have a member named provider.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
28
    assert route.provider._client_options['use_ssl'] is False
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like _client_options 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...
Bug introduced by
The Instance of SQSRoute does not seem to have a member named provider.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
29
30
31
def test_sns_queue_route(dummy_handler):
32
    route = SNSQueueRoute('what', handler=dummy_handler)
33
    assert isinstance(route.message_translator, SNSMessageTranslator)
0 ignored issues
show
Bug introduced by
The Instance of SNSQueueRoute does not seem to have a member named message_translator.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
34
    assert isinstance(route.provider, SQSProvider)
0 ignored issues
show
Bug introduced by
The Instance of SNSQueueRoute does not seem to have a member named provider.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
35
    assert route.name == 'what'
0 ignored issues
show
Bug introduced by
The Instance of SNSQueueRoute does not seem to have a member named name.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
36
37
38
def test_sns_queue_route_keep_message_translator(dummy_handler):
0 ignored issues
show
Coding Style Naming introduced by
The name test_sns_queue_route_keep_message_translator does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
39
    route = SNSQueueRoute('what', handler=dummy_handler, message_translator=SQSMessageTranslator())
40
    assert isinstance(route.message_translator, SQSMessageTranslator)
0 ignored issues
show
Bug introduced by
The Instance of SNSQueueRoute does not seem to have a member named message_translator.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
41
    route = SNSQueueRoute('what', handler=dummy_handler, message_translator=None)
42
    assert route.message_translator is None
0 ignored issues
show
Bug introduced by
The Instance of SNSQueueRoute does not seem to have a member named message_translator.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
43
44
45
def test_sns_queue_route_keep_name(dummy_handler):
46
    route = SNSQueueRoute('what', handler=dummy_handler, name='foobar')
47
    assert route.name == 'foobar'
0 ignored issues
show
Bug introduced by
The Instance of SNSQueueRoute does not seem to have a member named name.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
48
49
50
def test_sns_queue_route_provider_options(dummy_handler):
0 ignored issues
show
Coding Style Naming introduced by
The name test_sns_queue_route_provider_options does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
51
    route = SNSQueueRoute('what', provider_options={'region_name': 'sa-east-1'}, handler=dummy_handler, name='foobar')
52
    assert 'region_name' in route.provider._client_options
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like _client_options 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...
Bug introduced by
The Instance of SNSQueueRoute does not seem to have a member named provider.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
53
    assert route.provider._client_options['region_name'] == 'sa-east-1'
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like _client_options 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...
Bug introduced by
The Instance of SNSQueueRoute does not seem to have a member named provider.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
54