Commit 169689f7bbbdfaac053d74ae567fd4967bfe4509
1 parent
6c215efe
Exists in
master
and in
30 other branches
Fix signals in plugins.utils and plugins.gitlab
plugins.utils: Removed unnecessary parameter from lambda in getattr call and fix test itself plugins.gitlab: Remove signals.py file and implement register and connect signals in apps.py Signed-off-by: Lucas Moura <lucas.moura128@gmail.com>
Showing
4 changed files
with
10 additions
and
17 deletions
Show diff stats
colab/plugins/gitlab/apps.py
1 | 1 | |
2 | 2 | from ..utils.apps import ColabProxiedAppConfig |
3 | +from colab.plugins.gitlab.tasks import handling_method | |
4 | +from colab.signals.signals import register_signal, connect_signal | |
3 | 5 | |
4 | 6 | |
5 | 7 | class ProxyGitlabAppConfig(ColabProxiedAppConfig): |
... | ... | @@ -8,3 +10,9 @@ class ProxyGitlabAppConfig(ColabProxiedAppConfig): |
8 | 10 | short_name = 'gitlab' |
9 | 11 | |
10 | 12 | signals_list = ['gitlab_create_project'] |
13 | + | |
14 | + def register_signal(self): | |
15 | + register_signal(self.short_name, self.signals_list) | |
16 | + | |
17 | + def connect_signal(self): | |
18 | + connect_signal(self.signals_list[0], self.short_name, handling_method) | ... | ... |
colab/plugins/gitlab/signals.py
... | ... | @@ -1,15 +0,0 @@ |
1 | -from colab.plugins.utils.signals import AbstractSignal | |
2 | -from colab.plugins.gitlab.tasks import handling_method | |
3 | -from colab.signals.signals import register_signal, connect_signal | |
4 | - | |
5 | - | |
6 | -class GitlabSignals(AbstractSignal): | |
7 | - | |
8 | - short_name = 'gitlab' | |
9 | - signals_list = ['gitlab_create_project'] | |
10 | - | |
11 | - def register_signal(self): | |
12 | - register_signal(self.short_name, self.signals_list) | |
13 | - | |
14 | - def connect_signal(self): | |
15 | - connect_signal(self.signals_list[0], self.short_name, handling_method) |
colab/plugins/utils/signals.py
... | ... | @@ -11,7 +11,7 @@ def _init_signals(method_name): |
11 | 11 | # won't send it explicitly. |
12 | 12 | # If the method doesn't exist we return a dummy function that |
13 | 13 | # won't do anything. |
14 | - getattr(app, method_name, lambda x: None)(app) | |
14 | + getattr(app, method_name, lambda: None)() | |
15 | 15 | |
16 | 16 | |
17 | 17 | def register_signal(): | ... | ... |
colab/plugins/utils/tests/test_signals.py
... | ... | @@ -15,6 +15,6 @@ class SignalsTest(TestCase): |
15 | 15 | mock_app.return_value = apps_list |
16 | 16 | signals._init_signals(method_name) |
17 | 17 | |
18 | - app_mock.test.assert_called_with(app_mock) | |
18 | + app_mock.test.assert_called_with() | |
19 | 19 | self.assertEqual(1, app_mock.test.call_count) |
20 | 20 | self.assertTrue(app_mock.test.called) | ... | ... |