Commit 289c474d authored by Michal Čihař's avatar Michal Čihař

Coding style fixes

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 046b9e4d
...@@ -34,31 +34,31 @@ class ReportsTest(ViewTestCase): ...@@ -34,31 +34,31 @@ class ReportsTest(ViewTestCase):
self.user.save() self.user.save()
def add_change(self): def add_change(self):
response = self.edit_unit( self.edit_unit(
'Hello, world!\n', 'Hello, world!\n',
'Nazdar svete!\n' 'Nazdar svete!\n'
) )
def test_credits_empty(self): def test_credits_empty(self):
credits = generate_credits( data = generate_credits(
self.subproject, self.subproject,
timezone.now() - timedelta(days=1) timezone.now() - timedelta(days=1)
) )
self.assertEqual(credits, []) self.assertEqual(data, [])
def test_credits_one(self): def test_credits_one(self):
self.add_change() self.add_change()
credits = generate_credits( data = generate_credits(
self.subproject, self.subproject,
timezone.now() - timedelta(days=1) timezone.now() - timedelta(days=1)
) )
self.assertEqual( self.assertEqual(
credits, data,
[{'Czech': [('noreply@weblate.org', 'Weblate Test')]}] [{'Czech': [('noreply@weblate.org', 'Weblate Test')]}]
) )
def test_credits_more(self): def test_credits_more(self):
response = self.edit_unit( self.edit_unit(
'Hello, world!\n', 'Hello, world!\n',
'Nazdar svete2!\n' 'Nazdar svete2!\n'
) )
...@@ -70,9 +70,9 @@ class ReportsTest(ViewTestCase): ...@@ -70,9 +70,9 @@ class ReportsTest(ViewTestCase):
reverse('credits', kwargs=self.kw_subproject), reverse('credits', kwargs=self.kw_subproject),
{'style': 'json', 'start_date': '2000-01-01'}, {'style': 'json', 'start_date': '2000-01-01'},
) )
credits = json.loads(response.content) data = json.loads(response.content)
self.assertEqual( self.assertEqual(
credits, data,
[{'Czech': [['noreply@weblate.org', 'Weblate Test']]}] [{'Czech': [['noreply@weblate.org', 'Weblate Test']]}]
) )
......
...@@ -43,7 +43,7 @@ def generate_credits(component, start_date): ...@@ -43,7 +43,7 @@ def generate_credits(component, start_date):
) )
if not authors: if not authors:
continue continue
result.append({translation.language.name: sorted(set(authors))}) result.append({translation.language.name: sorted(set(authors))})
return result return result
...@@ -62,17 +62,17 @@ def get_credits(request, project, subproject): ...@@ -62,17 +62,17 @@ def get_credits(request, project, subproject):
if not form.is_valid(): if not form.is_valid():
return redirect(obj) return redirect(obj)
credits = generate_credits(obj, form.cleaned_data['start_date']) data = generate_credits(obj, form.cleaned_data['start_date'])
if form.cleaned_data['style'] == 'json': if form.cleaned_data['style'] == 'json':
return HttpResponse( return HttpResponse(
json.dumps(credits), json.dumps(data),
content_type='application/json' content_type='application/json'
) )
result = [] result = []
for language in credits: for language in data:
name, translators = language.items()[0] name, translators = language.items()[0]
result.append(u'* {0}\n'.format(name)) result.append(u'* {0}\n'.format(name))
result.append('\n'.join( result.append('\n'.join(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment