예제 #1
0
def logout(cmd, username=None):
    """Log out to remove access to Azure subscriptions"""
    if in_cloud_console():
        logger.warning(_CLOUD_CONSOLE_LOGOUT_WARNING)

    profile = Profile(cli_ctx=cmd.cli_ctx)
    if not username:
        username = profile.get_current_account_user()
    profile.logout(username)
예제 #2
0
def logout(cmd, username=None):
    """Log out to remove access to Azure subscriptions"""
    if in_cloud_console():
        logger.warning(_CLOUD_CONSOLE_LOGOUT_WARNING)

    profile = Profile(cli_ctx=cmd.cli_ctx)
    if not username:
        username = profile.get_current_account_user()
    profile.logout(username)
예제 #3
0
def logout(username=None):
    """Log out to remove access to Azure subscriptions"""
    if in_cloud_console():
        raise CLIError(_CLOUD_CONSOLE_ERR_TEMPLATE.format('logout'))

    profile = Profile()
    if not username:
        username = profile.get_current_account_user()
    profile.logout(username)
예제 #4
0
파일: custom.py 프로젝트: smoghe/azure-cli
def logout(username=None):
    """Log out to remove access to Azure subscriptions"""
    if _in_cloud_console():
        raise CLIError(_CLOUD_CONSOLE_ERR_TEMPLATE.format('logout'))

    profile = Profile()
    if not username:
        username = profile.get_current_account_user()
    profile.logout(username)
예제 #5
0
def logout(username=None):
    """Log out to remove access to Azure subscriptions"""
    if in_cloud_console():
        logger.warning(_CLOUD_CONSOLE_WARNING_TEMPLATE, 'logout')
        return

    profile = Profile()
    if not username:
        username = profile.get_current_account_user()
    profile.logout(username)
예제 #6
0
def logout(username=None):
    """Log out to remove access to Azure subscriptions"""
    if in_cloud_console():
        logger.warning(_CLOUD_CONSOLE_WARNING_TEMPLATE, 'logout')
        return

    profile = Profile()
    if not username:
        username = profile.get_current_account_user()
    profile.logout(username)
예제 #7
0
    def test_logout(self, mock_persist_creds, mock_read_cred_file):
        #setup
        mock_read_cred_file.return_value = [Test_Profile.token_entry1]

        storage_mock = {'subscriptions': None}
        profile = Profile(storage_mock)
        consolidated = Profile._normalize_properties(self.user1,
                                                     [self.subscription1],
                                                     False)
        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)
예제 #8
0
    def test_logout(self, mock_persist_creds, mock_read_cred_file):
        #setup
        mock_read_cred_file.return_value = [Test_Profile.token_entry1]

        storage_mock = {'subscriptions': None}
        profile = Profile(storage_mock)
        consolidated = Profile._normalize_properties(self.user1,
                                                     [self.subscription1],
                                                     False)
        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)
예제 #9
0
파일: custom.py 프로젝트: batizza/azure-cli
def logout(username=None):
    """Log out to remove access to Azure subscriptions"""
    profile = Profile()
    if not username:
        username = profile.get_current_account_user()
    profile.logout(username)
예제 #10
0
def logout(username=None):
    """Log out to remove access to Azure subscriptions"""
    profile = Profile()
    if not username:
        username = profile.get_current_account_user()
    profile.logout(username)