Ticket #9978: 9788.diff
File 9788.diff, 2.2 KB (added by , 16 years ago) |
---|
-
django/test/client.py
414 414 Causes the authenticated user to be logged out. 415 415 """ 416 416 session = __import__(settings.SESSION_ENGINE, {}, {}, ['']).SessionStore() 417 session.delete(session_key=self.cookies[settings.SESSION_COOKIE_NAME].value) 417 if self.cookies.has_key(settings.SESSION_COOKIE_NAME): 418 session.delete(session_key=self.cookies[settings.SESSION_COOKIE_NAME].value) 418 419 self.cookies = SimpleCookie() -
tests/modeltests/test_client/models.py
70 70 self.assertEqual(response.context['data'], '37') 71 71 self.assertEqual(response.template.name, 'POST Template') 72 72 self.failUnless('Data received' in response.content) 73 73 74 74 def test_response_headers(self): 75 75 "Check the value of HTTP headers returned in a response" 76 76 response = self.client.get("/test_client/header_view/") 77 77 78 78 self.assertEquals(response['X-DJANGO-TEST'], 'Slartibartfast') 79 79 80 80 def test_raw_post(self): 81 81 "POST raw data (with a content type) to a view" 82 82 test_doc = """<?xml version="1.0" encoding="utf-8"?><library><book><title>Blink</title><author>Malcolm Gladwell</author></book></library>""" … … 326 326 response = self.client.get('/test_client/login_protected_view/') 327 327 self.assertRedirects(response, 'http://testserver/accounts/login/?next=/test_client/login_protected_view/') 328 328 329 330 def test_null_logout(self): 331 #Logging out should do nothing, not raise a KeyError 332 #Ref ticket #9978 333 self.client.logout() 334 329 335 def test_view_with_permissions(self): 330 336 "Request a page that is protected with @permission_required" 331 337 … … 417 423 self.assertEqual(mail.outbox[1].from_email, 'from@example.com') 418 424 self.assertEqual(mail.outbox[1].to[0], 'second@example.com') 419 425 self.assertEqual(mail.outbox[1].to[1], 'third@example.com') 420