I have this simple test:
def setUp(self):
self.carrier = Carrier.objects.create(name='SomeCarrier')
self.dispatcher = Dispatcher.objects.create(carrier=self.carrier, email='dispatcher@email.com')
self.dispatcher.set_password('40')
self.dispatcher.save()
login = self.client.login(username='dispatcher@email.com', password='40')
self.assertTrue(login)
def test_payment_page_redirects_if_carrier_has_no_plan(self):
response = self.client.get(reverse('billing:payment'))
self.assertRedirects(response, reverse("dashboard:home"))
the line when I do self.client.get(...) is giving me the following error:
Traceback (most recent call last):
File "/home/dasar/virtualenvs/mds3/lib/python3.4/site-packages/django/core/handlers/base.py", line 204, in get_response
response = middleware_method(request, response)
File "/home/dasar/DjangoProjects/backend/apps/dashboard/middleware.py", line 13, in process_response
response.set_cookie('userName', quote(request.user.name))
File "/usr/lib/python3.4/urllib/parse.py", line 694, in quote
return quote_from_bytes(string, safe)
File "/usr/lib/python3.4/urllib/parse.py", line 719, in quote_from_bytes
raise TypeError("quote_from_bytes() expected bytes")
TypeError: quote_from_bytes() expected bytes
If I remove self.clinet.login code from the setUp function, the error disappears.
What could be the problem?
Aucun commentaire:
Enregistrer un commentaire