Esempio n. 1
0
 def test_validate_ticket_fails_with_invalid_ticket(self, MockHTTPSHandler):
     MockHTTPSHandler.https_request.return_value = MockRequest()
     MockHTTPSHandler.https_open.return_value = MockResponse(
         get_data('service_validate_invalid_ticket.xml'))
     self.assertFalse(
         validate_ticket('ST-001-abc', 'https://cas.domain.net',
                         'https://service.domain.net'))
Esempio n. 2
0
 def test_validate_ticket_suceeds_with_valid_ticket(self, MockHTTPSHandler):
     MockHTTPSHandler.https_request.return_value = MockRequest()
     MockHTTPSHandler.https_open.return_value = MockResponse(
         get_data('service_validate_success.xml'))
     self.assertEqual(
         'james',
         validate_ticket('ST-001-abc', 'https://cas.domain.net',
                         'https://service.domain.net'))
Esempio n. 3
0
 def test_validate_ticket_fails_with_invalid_ticket(self, MockHTTPSHandler):
     MockHTTPSHandler.https_request.return_value = MockRequest()
     MockHTTPSHandler.https_open.return_value = MockResponse(
         get_data('service_validate_invalid_ticket.xml'))
     self.assertFalse(validate_ticket(
         'ST-001-abc',
         'https://cas.domain.net',
         'https://service.domain.net'))
Esempio n. 4
0
 def test_validate_ticket_suceeds_with_valid_ticket(self, MockHTTPSHandler):
     MockHTTPSHandler.https_request.return_value = MockRequest()
     MockHTTPSHandler.https_open.return_value = MockResponse(
         get_data('service_validate_success.xml'))
     self.assertEqual('james', validate_ticket(
         'ST-001-abc',
         'https://cas.domain.net',
         'https://service.domain.net'))
Esempio n. 5
0
 def test_validate_ticket_suceeds_with_valid_ticket(self, MockHTTPSHandler):
     MockHTTPSHandler.https_request.return_value = MockRequest()
     MockHTTPSHandler.https_open.return_value = MockResponse(
         get_data('service_validate_success.xml'))
     user_id, attrs = validate_ticket('ST-001-abc',
                                      'https://cas.domain.net',
                                      'https://service.domain.net')
     self.assertEqual(user_id, 'james', 'Wrong validated user ID')
     self.assertEqual(
         attrs, {
             'authenticationDate': '2014-08-12T19:28:07Z',
             'longTermAuthenticationRequestTokenUsed': 'false',
             'isFromNewLogin': '******',
             'email': '*****@*****.**',
             'fullname': 'James Bond'
         }, 'Wrong validated user attributes')