replace \r\n in CAS v.1 validate response to \n
authorAlex Kamedov <alex@kamedov.ru>
Sun, 24 Apr 2011 14:20:26 +0000 (20:20 +0600)
committerAlex Kamedov <alex@kamedov.ru>
Sun, 24 Apr 2011 14:20:26 +0000 (20:20 +0600)
cas_provider/tests.py
cas_provider/views.py

index 5129d66..4d44242 100644 (file)
@@ -96,14 +96,14 @@ class ViewsTest(TestCase):
 
             response = self.client.get(reverse('cas_validate'), {'ticket': ticket, 'service': self.service}, follow=False)
             self.assertEqual(response.status_code, 200)
 
             response = self.client.get(reverse('cas_validate'), {'ticket': ticket, 'service': self.service}, follow=False)
             self.assertEqual(response.status_code, 200)
-            self.assertEqual(unicode(response.content), u'yes\r\n%s\r\n' % self.username)
+            self.assertEqual(unicode(response.content), u'yes\n%s\n' % self.username)
         else:
             self.assertEqual(response.status_code, 200)
             self.assertEqual(len(response.context['form'].errors), 1)
 
             response = self.client.get(reverse('cas_validate'), {'ticket': 'ST-12312312312312312312312', 'service': self.service}, follow=False)
             self.assertEqual(response.status_code, 200)
         else:
             self.assertEqual(response.status_code, 200)
             self.assertEqual(len(response.context['form'].errors), 1)
 
             response = self.client.get(reverse('cas_validate'), {'ticket': 'ST-12312312312312312312312', 'service': self.service}, follow=False)
             self.assertEqual(response.status_code, 200)
-            self.assertEqual(response.content, u'no\r\n\r\n')
+            self.assertEqual(response.content, u'no\n\n')
 
 
     def _validate_cas2(self, response, is_correct=True):
 
 
     def _validate_cas2(self, response, is_correct=True):
index 8a6e4bf..b2e54f2 100644 (file)
@@ -67,10 +67,10 @@ def validate(request):
             ticket = ServiceTicket.objects.get(ticket=ticket_string)
             username = ticket.user.username
             ticket.delete()
             ticket = ServiceTicket.objects.get(ticket=ticket_string)
             username = ticket.user.username
             ticket.delete()
-            return HttpResponse("yes\r\n%s\r\n" % username)
+            return HttpResponse("yes\n%s\n" % username)
         except:
             pass
         except:
             pass
-    return HttpResponse("no\r\n\r\n")
+    return HttpResponse("no\n\n")
 
 
 def logout(request, template_name='cas/logout.html'):
 
 
 def logout(request, template_name='cas/logout.html'):