Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 4
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 9
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)
Ejemplo n.º 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)