+ def test_generate_proxy_granting_ticket(self):
+ urllib2.urlopen = dummy_urlopen # monkey patching urllib2.urlopen so that the testcase doesnt really opens a url
+ url = 'http://my.call.back/callhere'
+
+ user = User.objects.get(username = 'root')
+ st = ServiceTicket.objects.create(user = user )
+ pgt = generate_proxy_granting_ticket(url, st)
+ self.assertIsNotNone(pgt)
+
+ calledUrl = cas_provider.tests.dummy_urlopen_url
+ parsedUrl = urlparse(calledUrl)
+ params = parse_qs(parsedUrl.query)
+ self.assertIsNotNone(params['pgtId'])
+ self.assertIsNotNone(params['pgtIou'])
+
+
+