Add helper to check HttpResponse containing csv

This commit is contained in:
Aurélien Delobelle 2018-01-22 14:49:02 +01:00
parent c239f28f17
commit 80ca35a4c0

View file

@ -1,3 +1,4 @@
import csv
from unittest import mock
from urllib.parse import parse_qs, urlparse
@ -92,6 +93,10 @@ class TestCaseMixin:
else:
self.assertEqual(actual, expected)
def load_from_csv_response(self, r):
decoded = r.content.decode('utf-8')
return list(csv.reader(decoded.split('\n')[:-1]))
class ViewTestCaseMixin(TestCaseMixin):
"""