本文整理匯總了Python中clc_ansible_module.clc_publicip.ClcPublicIp._set_clc_credentials_from_env方法的典型用法代碼示例。如果您正苦於以下問題:Python ClcPublicIp._set_clc_credentials_from_env方法的具體用法?Python ClcPublicIp._set_clc_credentials_from_env怎麽用?Python ClcPublicIp._set_clc_credentials_from_env使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類clc_ansible_module.clc_publicip.ClcPublicIp
的用法示例。
在下文中一共展示了ClcPublicIp._set_clc_credentials_from_env方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_set_clc_credentials_w_token
# 需要導入模塊: from clc_ansible_module.clc_publicip import ClcPublicIp [as 別名]
# 或者: from clc_ansible_module.clc_publicip.ClcPublicIp import _set_clc_credentials_from_env [as 別名]
def test_set_clc_credentials_w_token(self):
with patch.dict('os.environ', {'CLC_V2_API_TOKEN': 'Token12345',
'CLC_ACCT_ALIAS': 'TEST' }):
with patch.object(ClcPublicIp, 'clc') as mock_clc_sdk:
under_test = ClcPublicIp(self.module)
under_test._set_clc_credentials_from_env()
self.assertEqual(mock_clc_sdk._LOGIN_TOKEN_V2, 'Token12345')
self.assertFalse(mock_clc_sdk.v2.SetCredentials.called)
self.assertEqual(self.module.fail_json.called, False)
示例2: test_set_clc_credentials_w_no_creds
# 需要導入模塊: from clc_ansible_module.clc_publicip import ClcPublicIp [as 別名]
# 或者: from clc_ansible_module.clc_publicip.ClcPublicIp import _set_clc_credentials_from_env [as 別名]
def test_set_clc_credentials_w_no_creds(self):
with patch.dict('os.environ', {}, clear=True):
under_test = ClcPublicIp(self.module)
under_test._set_clc_credentials_from_env()
self.assertEqual(self.module.fail_json.called, True)
示例3: test_set_clc_credentials_w_api_url
# 需要導入模塊: from clc_ansible_module.clc_publicip import ClcPublicIp [as 別名]
# 或者: from clc_ansible_module.clc_publicip.ClcPublicIp import _set_clc_credentials_from_env [as 別名]
def test_set_clc_credentials_w_api_url(self, mock_clc_sdk):
with patch.dict('os.environ', {'CLC_V2_API_URL': 'dummyapiurl'}):
under_test = ClcPublicIp(self.module)
under_test._set_clc_credentials_from_env()
self.assertEqual(under_test.clc.defaults.ENDPOINT_URL_V2, 'dummyapiurl')
示例4: test_set_clc_credentials_w_creds
# 需要導入模塊: from clc_ansible_module.clc_publicip import ClcPublicIp [as 別名]
# 或者: from clc_ansible_module.clc_publicip.ClcPublicIp import _set_clc_credentials_from_env [as 別名]
def test_set_clc_credentials_w_creds(self):
with patch.dict('os.environ', {'CLC_V2_API_USERNAME': 'hansolo', 'CLC_V2_API_PASSWD': 'falcon'}):
with patch.object(ClcPublicIp, 'clc') as mock_clc_sdk:
under_test = ClcPublicIp(self.module)
under_test._set_clc_credentials_from_env()
mock_clc_sdk.v2.SetCredentials.assert_called_once_with(api_username='hansolo', api_passwd='falcon')