Commit 9bdee49dd2207e6ef36b2c7d528291a970986d47
1 parent
b6548e0c
Exists in
gitlab_activity_view
Fixed flake8
Signed-off-by: Macartur Sousa <macartur.sc@gmail.com>
Showing
6 changed files
with
22 additions
and
26 deletions
Show diff stats
src/colab-spb-plugin/src/colab_spb/urls.py
@@ -3,4 +3,5 @@ from . import views | @@ -3,4 +3,5 @@ from . import views | ||
3 | 3 | ||
4 | urlpatterns = patterns('', | 4 | urlpatterns = patterns('', |
5 | url(r'^mail_list/$', views.mail_list, name='mail_list'), | 5 | url(r'^mail_list/$', views.mail_list, name='mail_list'), |
6 | - url(r'^gitlab_activity/$', views.gitlab_activity, name='gitlab_activity'),) | 6 | + url(r'^gitlab_activity/$', views.gitlab_activity, |
7 | + name='gitlab_activity'),) |
src/colab-spb-plugin/src/colab_spb/views.py
@@ -9,7 +9,7 @@ from colab_spb.models import CommunityAssociations | @@ -9,7 +9,7 @@ from colab_spb.models import CommunityAssociations | ||
9 | 9 | ||
10 | def mail_list(request): | 10 | def mail_list(request): |
11 | community = request.GET.get('community', "") | 11 | community = request.GET.get('community', "") |
12 | - list_name = get_community_association(community).get("mailman_list","") | 12 | + list_name = get_community_association(community).get("mailman_list", "") |
13 | 13 | ||
14 | MAX = request.GET.get('MAX', 7) | 14 | MAX = request.GET.get('MAX', 7) |
15 | if not MAX or MAX < 0: | 15 | if not MAX or MAX < 0: |
@@ -53,8 +53,8 @@ def mail_list(request): | @@ -53,8 +53,8 @@ def mail_list(request): | ||
53 | 53 | ||
54 | def gitlab_activity(request): | 54 | def gitlab_activity(request): |
55 | community = request.GET.get('community', "") | 55 | community = request.GET.get('community', "") |
56 | - limit = request.GET.get('limit',7) | ||
57 | - offset = request.GET.get('offset',0) | 56 | + limit = request.GET.get('limit', 7) |
57 | + offset = request.GET.get('offset', 0) | ||
58 | 58 | ||
59 | context = {} | 59 | context = {} |
60 | context['message'] = ("Esta comunidade não está associada a" | 60 | context['message'] = ("Esta comunidade não está associada a" |
@@ -62,22 +62,21 @@ def gitlab_activity(request): | @@ -62,22 +62,21 @@ def gitlab_activity(request): | ||
62 | " detalhes contate o administrador.") | 62 | " detalhes contate o administrador.") |
63 | 63 | ||
64 | association = get_community_association(community, limit, offset) | 64 | association = get_community_association(community, limit, offset) |
65 | - context['community_association'] = association | 65 | + context['community_association'] = association |
66 | 66 | ||
67 | return render(request, 'gitlab_activity.html', context) | 67 | return render(request, 'gitlab_activity.html', context) |
68 | 68 | ||
69 | -def get_community_association(community,limit=7,offset=0): | 69 | + |
70 | +def get_community_association(community, limit=7, offset=0): | ||
70 | if not community: | 71 | if not community: |
71 | return {} | 72 | return {} |
72 | 73 | ||
73 | associations = CommunityAssociations.objects.all() | 74 | associations = CommunityAssociations.objects.all() |
74 | for community_association in associations: | 75 | for community_association in associations: |
75 | if community_association.community.name in community: | 76 | if community_association.community.name in community: |
76 | - return { 'community': community_association.community.name, | ||
77 | - 'repository': community_association.group.url, | ||
78 | - 'mailman_list': community_association.mail_list.name, | ||
79 | - 'limit': limit, | ||
80 | - 'offset': offset, | ||
81 | - } | ||
82 | - | 77 | + return {'community': community_association.community.name, |
78 | + 'repository': community_association.group.url, | ||
79 | + 'mailman_list': community_association.mail_list.name, | ||
80 | + 'limit': limit, | ||
81 | + 'offset': offset} | ||
83 | return {} | 82 | return {} |
src/colab-spb-plugin/tests/plugins.d/gitlab.py
@@ -10,7 +10,7 @@ name = 'colab_gitlab' | @@ -10,7 +10,7 @@ name = 'colab_gitlab' | ||
10 | verbose_name = 'Gitlab Plugin' | 10 | verbose_name = 'Gitlab Plugin' |
11 | 11 | ||
12 | upstream = 'localhost' | 12 | upstream = 'localhost' |
13 | -#middlewares = [] | 13 | +# middlewares = [] |
14 | 14 | ||
15 | urls = { | 15 | urls = { |
16 | 'include': 'colab_gitlab.urls', | 16 | 'include': 'colab_gitlab.urls', |
src/colab-spb-plugin/tests/plugins.d/noosfero.py
@@ -10,7 +10,7 @@ name = 'colab_noosfero' | @@ -10,7 +10,7 @@ name = 'colab_noosfero' | ||
10 | verbose_name = 'Noosfero Plugin' | 10 | verbose_name = 'Noosfero Plugin' |
11 | 11 | ||
12 | upstream = 'localhost' | 12 | upstream = 'localhost' |
13 | -#middlewares = [] | 13 | +# middlewares = [] |
14 | 14 | ||
15 | urls = { | 15 | urls = { |
16 | 'include': 'colab_noosfero.urls', | 16 | 'include': 'colab_noosfero.urls', |
src/colab-spb-plugin/tests/plugins.d/spb.py
1 | -from django.utils.translation import ugettext_lazy as _ | ||
2 | -from colab.plugins.utils.menu import colab_url_factory | ||
3 | - | 1 | +from colab.plugins.utils.menu import colab_url_factory |
2 | + | ||
4 | name = "colab_spb" | 3 | name = "colab_spb" |
5 | verbose_name = "SPB Plugin" | 4 | verbose_name = "SPB Plugin" |
6 | 5 | ||
7 | middlewares = ['colab_spb.middleware.ForceLangMiddleware'] | 6 | middlewares = ['colab_spb.middleware.ForceLangMiddleware'] |
8 | 7 | ||
9 | -urls = { | ||
10 | - "include":"colab_spb.urls", | ||
11 | - "prefix": '^spb/', | ||
12 | - "namespace":"colab_spb" | ||
13 | - } | 8 | +urls = {"include": "colab_spb.urls", |
9 | + "prefix": '^spb/', | ||
10 | + "namespace": "colab_spb"} | ||
14 | 11 | ||
15 | url = colab_url_factory('colab_spb') | 12 | url = colab_url_factory('colab_spb') |
src/colab-spb-plugin/tests/test_colab_integration.py
@@ -43,7 +43,7 @@ class SPBTest(TestCase): | @@ -43,7 +43,7 @@ class SPBTest(TestCase): | ||
43 | " nenhum repositório no momento, para mais" | 43 | " nenhum repositório no momento, para mais" |
44 | " detalhes contate o administrador.") | 44 | " detalhes contate o administrador.") |
45 | self.assertIn(message, response.content) | 45 | self.assertIn(message, response.content) |
46 | - self.assertEqual(dict() ,response.context['community_association']) | 46 | + self.assertEqual(dict(), response.context['community_association']) |
47 | self.assertEqual(200, response.status_code) | 47 | self.assertEqual(200, response.status_code) |
48 | 48 | ||
49 | def test_gitlab_community_association_with_valid_community(self): | 49 | def test_gitlab_community_association_with_valid_community(self): |
@@ -70,7 +70,6 @@ class SPBTest(TestCase): | @@ -70,7 +70,6 @@ class SPBTest(TestCase): | ||
70 | self.assertEqual(type(result), dict) | 70 | self.assertEqual(type(result), dict) |
71 | self.assertEqual(result['limit'], "5") | 71 | self.assertEqual(result['limit'], "5") |
72 | 72 | ||
73 | - | ||
74 | def test_gitlab_community_association_with_no_default_offset(self): | 73 | def test_gitlab_community_association_with_no_default_offset(self): |
75 | response = self.client.get("/spb/gitlab_activity/" | 74 | response = self.client.get("/spb/gitlab_activity/" |
76 | "?community=example_community" | 75 | "?community=example_community" |
@@ -78,4 +77,4 @@ class SPBTest(TestCase): | @@ -78,4 +77,4 @@ class SPBTest(TestCase): | ||
78 | 77 | ||
79 | result = response.context['community_association'] | 78 | result = response.context['community_association'] |
80 | 79 | ||
81 | - self.assertEqual(result['offset'],"5") | 80 | + self.assertEqual(result['offset'], "5") |