- self.assertGreater(len(response.context['errors']), 0)
- self.assertEqual(len(response.context['form'].errors), 0)
+ 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')
+
+
+class ModelsTestCase(TestCase):
+
+ fixtures = ['cas_users.json', ]
+
+ def setUp(self):
+ self.user = User.objects.get(username='root')
+
+ def test_redirects(self):
+ ticket = ServiceTicket.objects.create(service='http://example.com', user=self.user)
+ self.assertEqual(ticket.get_redirect_url(), '%(service)s?ticket=%(ticket)s' % ticket.__dict__)