def test_verify_cas2_with_pgt(self): urllib.urlopen = dummyUrlOpenWithProxyGrantingTikcet # st = ServiceTicket.objects.create(); tgt = Tgt.objects.create(username="******") PgtIOU.objects.create(tgt=tgt, pgtIou="PGTIOU-NUYny6RiAfHBsuWq270m3l1kgPTjEOCexpowQV9ZJDrh8cGKzb") settings.CAS_PROXY_CALLBACK = "http://dummy2" prior = PgtIOU.objects.count() user, authentication_response = _verify_cas2("ST-jkadfhjksdhjkfh", "http://dummy") self.assertEqual(prior - 1, PgtIOU.objects.count()) # the pgtiou should be used up and deleted self.assertEqual("sannies", user)
def test_verify_cas2_with_pgt(self): urllib.urlopen = dummyUrlOpenWithProxyGrantingTikcet #st = ServiceTicket.objects.create() tgt = Tgt.objects.create(username='******') PgtIOU.objects.create(tgt=tgt, pgtIou='PGTIOU-NUYny6RiAfHBsuWq270m3l1kgPTjEOCexpowQV9ZJDrh8cGKzb') settings.CAS_PROXY_CALLBACK = "http://dummy2" prior = PgtIOU.objects.count() user, authentication_response = _verify_cas2('ST-jkadfhjksdhjkfh', 'http://dummy') self.assertEqual(prior - 1, PgtIOU.objects.count()) # the pgtiou should be used up and deleted self.assertEqual('sannies', user)
def test_verify_cas2_no_pgt(self): urllib.urlopen = dummyUrlOpenNoProxyGrantingTicket settings.CAS_PROXY_CALLBACK = None user, authentication_response = _verify_cas2('ST-jkadfhjksdhjkfh', 'http://dummy') self.assertEqual('sannies', user)
def test_verify_cas2_no_pgt(self): urllib.urlopen = dummyUrlOpenNoProxyGrantingTicket settings.CAS_PROXY_CALLBACK = None user, authentication_response = _verify_cas2("ST-jkadfhjksdhjkfh", "http://dummy") self.assertEqual("sannies", user)