+ #Step 2: Get the actual proxy ticket
+ proxyTicketResponse_1 = self.client.get(reverse('proxy'), {'targetService': proxyTarget_1, 'pgt': pgtId_1}, follow=False)
+ proxyTicketResponseXml_1 = ElementTree.parse(StringIO.StringIO(proxyTicketResponse_1.content))
+ self.assertIsNotNone(proxyTicketResponseXml_1.find(CAS + "proxySuccess", namespaces=NSMAP))
+ self.assertIsNotNone(proxyTicketResponseXml_1.find(CAS + "proxySuccess/cas:proxyTicket", namespaces=NSMAP))
+ proxyTicket_1 = proxyTicketResponseXml_1.find(CAS + "proxySuccess/cas:proxyTicket", namespaces=NSMAP);
+
+ #Step 3: I'm backend service 1 - I have the proxy ticket - I want to talk to back service 2
+ #
+ proxyValidateResponse_1 = self.client.get(reverse('cas_proxy_validate'), {'ticket': proxyTicket_1.text, 'service': proxyTarget_1, 'pgtUrl': proxyTarget_2})
+ proxyValidateResponseXml_1 = ElementTree.parse(StringIO.StringIO(proxyValidateResponse_1.content))
+
+ auth_success_2 = proxyValidateResponseXml_1.find(CAS + 'authenticationSuccess', namespaces=NSMAP)
+ user_2 = auth_success_2.find(CAS + "user", namespaces=NSMAP)
+
+ proxies_1 = auth_success_2.find(CAS + "proxies")
+ self.assertIsNone(proxies_1) # there are no proxies. I am issued by a Service Ticket
+ self.assertIsNotNone(auth_success_2)
+ self.assertEqual('root', user_2.text)
+
+ pgt_2 = auth_success_2.find(CAS + "proxyGrantingTicket", namespaces=NSMAP)
+ user = auth_success_2.find(CAS + "user", namespaces=NSMAP)
+ self.assertEqual('root', user.text)
+ self.assertIsNotNone(pgt_2.text)
+ self.assertTrue(pgt_2.text.startswith('PGTIOU'))
+
+ pgtId_2 = parse_qs(urlparse(cas_provider.tests.dummy_urlopen_url).query)['pgtId']