def _get_test_api_url(self): cas_client = CASClient('https://dummy.url') api_resource = 'do_something_useful' auth_token_ticket = 'ATT-1234' authenticator = 'my_company_ldap' with open(self.private_key_filepath, 'r') as file_pointer: private_key = file_pointer.read() service_url = 'https://example.com' kwargs = { 'and': 'another_thing', 'you': 'should_know', } return cas_client.get_api_url(api_resource=api_resource, auth_token_ticket=auth_token_ticket, authenticator=authenticator, private_key=private_key, service_url=service_url, **kwargs)
def test_get_api_url(self): cas_client = CASClient('https://dummy.url') api_resource = 'do_something_useful' auth_token_ticket = 'ATT-1234' authenticator = 'my_company_ldap' with open(self.private_key_filepath, 'r') as file_pointer: private_key = file_pointer.read() service_url = 'https://example.com' kwargs = { 'and': 'another_thing', 'you': 'should_know', } url = cas_client.get_api_url(api_resource=api_resource, auth_token_ticket=auth_token_ticket, authenticator=authenticator, private_key=private_key, service_url=service_url, **kwargs) query_string = url.partition('?')[-1] query_parameters = { key: value[0] for key, value in parse_qs(query_string).items() } assert query_parameters == { 'at': ('eyJhbmQiOiAiYW5vdGhlcl90aGluZyIsICJhdXRoZW50aWNhdG9yIjogIm15' 'X2NvbXBhbnlfbGRhcCIsICJ0aWNrZXQiOiAiQVRULTEyMzQiLCAieW91Ijog' 'InNob3VsZF9rbm93In0='), 'ats': ('FISMx+fVfKKzI160MQRMauKdeqBRzzg+Ihwh0WqhqcnW4d+S0IyrTg6/oY1a' 'wGvhBGrSMzOEBfYyihj5SxmLMr+xWm5Ndt+m0WcjuOR2GEwtEimIbbEQslCu' 'f+//tG2u3UacStBRctt/cWnIGlW9cIPlUgU4iVVQtpbC7DdJc9+2rwzN10jV' '36JUwAWWT3iQseTiyMy+Bbuu1bzTcdtKvBdHTnCwcu1m9vkQraH/ZuVbYVMB' 'jZC1s5lXECLN+fnC00laglYmgQ1w59EoQIXuaaHFqgq+zRvRxm4r0ASG5F0D' 'bPT0fEDihQulSAbyOY5/6nhkFq6NYlJADKuGchFusk9D3Pcgs2KyEW3xvBb4' 'ZArn2oaI8sxjOYUXutf1xe5MBGy8oTW+3QbHVv+hzXOrwJXsbSz6bx3gmDYb' 'bDilhbRgPQeTH17IwqArrVgnjgcAMoDk6cTqU548S19KMc8B99pVZ7JMM5Ls' 'uKx/ZWUF0naXFeuEaFJ5TdaO6HhhiRhUAEwlnwTQwwJuR1VtcYx4z3Lb5NhN' 'CtH658M8acru4Dv4jV5NC3IPJcCijKGVjZQ0K6GrD863fr3usnH1gvnTzNgJ' '1jijF4FmyIr8E9kpNM5Mk7D0AqSGCC2nZcu/r4+2rcLiq9XxViv3jpe44alQ' 'RjhkcqcbkcJvnhckfgjrU7w='), 'service': 'https://example.com', }