Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_oauth2_client_stub(self, authority, token_response, err):
authorityObject = Authority(authority, False)
authorityObject.token_endpoint = AADConstants.TOKEN_ENDPOINT_PATH
authorityObject.device_code_endpoint = AADConstants.DEVICE_ENDPOINT_PATH
client = OAuth2Client(cp['callContext'], authorityObject)
def side_effect (oauth):
return token_response
client.get_token = mock.MagicMock(side_effect=side_effect)
return client
def test_api_version_is_set(self):
client = adal.oauth2_client.OAuth2Client(
{"api_version": "1.0", "log_context": mock.Mock()}, self.authority)
self.assertIn('api-version=1.0', client._create_token_url().geturl())
def _create_oauth2_client(self):
return oauth2_client.OAuth2Client(self._call_context,
self._authentication_context.authority)
def _create_oauth2_client(self):
return oauth2_client.OAuth2Client(
self._call_context,
self._authentication_context.authority)