本文整理汇总了Python中azure.cli._profile.Profile.logout方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.logout方法的具体用法?Python Profile.logout怎么用?Python Profile.logout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azure.cli._profile.Profile
的用法示例。
在下文中一共展示了Profile.logout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_logout
# 需要导入模块: from azure.cli._profile import Profile [as 别名]
# 或者: from azure.cli._profile.Profile import logout [as 别名]
def test_logout(self, mock_persist_creds, mock_read_cred_file):
#setup
mock_read_cred_file.return_value = json.dumps([Test_Profile.token_entry1])
storage_mock = {'subscriptions': None}
profile = Profile(storage_mock)
consolidated = Profile._normalize_properties(self.user1,
[self.subscription1],
False,
ENV_DEFAULT)
profile._set_subscriptions(consolidated)
self.assertEqual(1, len(storage_mock['subscriptions']))
#action
profile.logout(self.user1)
#verify
self.assertEqual(0, len(storage_mock['subscriptions']))
self.assertEqual(mock_read_cred_file.call_count, 1)
self.assertEqual(mock_persist_creds.call_count, 1)
示例2: logout
# 需要导入模块: from azure.cli._profile import Profile [as 别名]
# 或者: from azure.cli._profile.Profile import logout [as 别名]
def logout(username=None):
'''Log out from Azure subscription using Active Directory'''
profile = Profile()
if not username:
username = profile.get_current_account_user()
profile.logout(username)