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):
self.user.save()
def add_change(self):
response = self.edit_unit(
self.edit_unit(
'Hello, world!\n',
'Nazdar svete!\n'
)
def test_credits_empty(self):
credits = generate_credits(
data = generate_credits(
self.subproject,
timezone.now() - timedelta(days=1)
)
self.assertEqual(credits, [])
self.assertEqual(data, [])
def test_credits_one(self):
self.add_change()
credits = generate_credits(
data = generate_credits(
self.subproject,
timezone.now() - timedelta(days=1)
)
self.assertEqual(
credits,
data,
[{'Czech': [('noreply@weblate.org', 'Weblate Test')]}]
)
def test_credits_more(self):
response = self.edit_unit(
self.edit_unit(
'Hello, world!\n',
'Nazdar svete2!\n'
)
......@@ -70,9 +70,9 @@ class ReportsTest(ViewTestCase):
reverse('credits', kwargs=self.kw_subproject),
{'style': 'json', 'start_date': '2000-01-01'},
)
credits = json.loads(response.content)
data = json.loads(response.content)
self.assertEqual(
credits,
data,
[{'Czech': [['noreply@weblate.org', 'Weblate Test']]}]
)
......
......@@ -43,7 +43,7 @@ def generate_credits(component, start_date):
)
if not authors:
continue
result.append({translation.language.name: sorted(set(authors))})
result.append({translation.language.name: sorted(set(authors))})
return result
......@@ -62,17 +62,17 @@ def get_credits(request, project, subproject):
if not form.is_valid():
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':
return HttpResponse(
json.dumps(credits),
json.dumps(data),
content_type='application/json'
)
result = []
for language in credits:
for language in data:
name, translators = language.items()[0]
result.append(u'* {0}\n'.format(name))
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