示例#1
0
    def test_get_current_account_user(self, 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)
        #action
        user = profile.get_current_account_user()

        #verify
        self.assertEqual(user, self.user1)
    def test_get_current_account_user(self, 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)
        #action
        user = profile.get_current_account_user()

        #verify
        self.assertEqual(user, self.user1)
示例#3
0
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)
示例#4
0
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)