Commit 069cf133 authored by Michal Čihař's avatar Michal Čihař

Fix reports tests with Python 3

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent a4f09631
...@@ -82,7 +82,7 @@ class ReportsTest(ViewTestCase): ...@@ -82,7 +82,7 @@ class ReportsTest(ViewTestCase):
def test_credits_view_json(self): def test_credits_view_json(self):
response = self.get_credits('json') response = self.get_credits('json')
data = json.loads(response.content) data = json.loads(response.content.decode('utf-8'))
self.assertEqual( self.assertEqual(
data, data,
[{'Czech': [['noreply@weblate.org', 'Weblate Test']]}] [{'Czech': [['noreply@weblate.org', 'Weblate Test']]}]
...@@ -91,14 +91,14 @@ class ReportsTest(ViewTestCase): ...@@ -91,14 +91,14 @@ class ReportsTest(ViewTestCase):
def test_credits_view_rst(self): def test_credits_view_rst(self):
response = self.get_credits('rst') response = self.get_credits('rst')
self.assertEqual( self.assertEqual(
response.content, response.content.decode('utf-8'),
'\n\n* Czech\n\n * Weblate Test <noreply@weblate.org>\n\n' '\n\n* Czech\n\n * Weblate Test <noreply@weblate.org>\n\n'
) )
def test_credits_view_html(self): def test_credits_view_html(self):
response = self.get_credits('html') response = self.get_credits('html')
self.assertEqual( self.assertHTMLEqual(
response.content, response.content.decode('utf-8'),
'<table>\n' '<table>\n'
'<tr>\n<th>Czech</th>\n' '<tr>\n<th>Czech</th>\n'
'<td><ul><li><a href="mailto:noreply@weblate.org">' '<td><ul><li><a href="mailto:noreply@weblate.org">'
...@@ -136,7 +136,7 @@ class ReportsTest(ViewTestCase): ...@@ -136,7 +136,7 @@ class ReportsTest(ViewTestCase):
def test_counts_view_json(self): def test_counts_view_json(self):
response = self.get_counts('json') response = self.get_counts('json')
data = json.loads(response.content) data = json.loads(response.content.decode('utf-8'))
self.assertEqual( self.assertEqual(
data, data,
[{ [{
...@@ -153,8 +153,8 @@ class ReportsTest(ViewTestCase): ...@@ -153,8 +153,8 @@ class ReportsTest(ViewTestCase):
def test_counts_view_html(self): def test_counts_view_html(self):
response = self.get_counts('html') response = self.get_counts('html')
self.assertEqual( self.assertHTMLEqual(
response.content, response.content.decode('utf-8'),
'<table>\n' '<table>\n'
'<tr><th>Name</th><th>Email</th><th>Words</th><th>Count</th></tr>' '<tr><th>Name</th><th>Email</th><th>Words</th><th>Count</th></tr>'
'\n' '\n'
......
...@@ -100,7 +100,7 @@ def get_credits(request, project, subproject): ...@@ -100,7 +100,7 @@ def get_credits(request, project, subproject):
result.append(start) result.append(start)
for language in data: for language in data:
name, translators = language.items()[0] name, translators = language.popitem()
result.append(row_start) result.append(row_start)
result.append(language_format.format(name)) result.append(language_format.format(name))
result.append( result.append(
......
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