def get_tokens(auth_code): token_response = adal._acquire_token_with_authorization_code( authorityUrl, app_creds.CLIENT_ID, app_creds.CLIENT_SECRET, str(auth_code), url_for('authorized_view', _external=True), resource, ) return token_response
def get_tokens(auth_code): token_response = adal._acquire_token_with_authorization_code( authorityUrl, app_creds.CLIENT_ID, app_creds.CLIENT_SECRET, auth_code, url_for('authorized_view', _external=True), resource, ) return token_response
def test_happy_path(self): response = util.create_response() self.setup_expected_auth_code_token_request_response(200, response['wireResponse']) token_response = adal._acquire_token_with_authorization_code(cp['authUrl'], cp['clientId'], cp['clientSecret'], self.authorization_code, self.redirect_uri, response['resource']) self.assertTrue(util.is_match_token_response(response['decodedResponse'], token_response), 'The response did not match what was expected') req = httpretty.last_request() util.match_standard_request_headers(req)
def test_happy_path(self): response = util.create_response() self.setup_expected_auth_code_token_request_response( 200, response['wireResponse']) token_response = adal._acquire_token_with_authorization_code( cp['authUrl'], cp['clientId'], cp['clientSecret'], self.authorization_code, self.redirect_uri, response['resource']) self.assertTrue( util.is_match_token_response(response['decodedResponse'], token_response), 'The response did not match what was expected') req = httpretty.last_request() util.match_standard_request_headers(req)
def test_bad_argument(self): with self.assertRaises(Exception): adal._acquire_token_with_authorization_code( 'https://0.1.1.1:12/my.tenant.com', cp['clientId'], cp['clientSecret'], self.authorization_code, self.redirect_uri, 'BogusResource')
def test_failed_http_request(self): with self.assertRaises(Exception): adal._acquire_token_with_authorization_code( 'https://0.1.1.1:12/my.tenant.com', cp['clientId'], cp['clientSecret'], self.authorization_code, self.redirect_uri, response['resource'])