st2client/tests/unit/test_auth.py
def runTest(self, mock_cli):
        '''Test 'st2 whoami' ability to detect unhandled exceptions
        '''

        # Only mocking "BaseCLIApp" here in order to generate an exception for this specific test
        mock_cli.return_value._get_config_file_path = mock.MagicMock(side_effect=Exception)

        retcode = self.shell.run(['--config', self.CONFIG_FILE, 'whoami'])

        self.assertEqual('Unable to retrieve currently logged-in user',
                         self.stdout.getvalue().strip())
        self.assertEqual(retcode, 0)
Test 'st2 whoami' ability to detect unhandled exceptions
        
Test 'st2 whoami' ability to detect unhandled exceptions
Test ' st2 whoami ' ability to detect unhandled exceptions
def runTest(self, mock_cli):
        mock_cli.return_value._get_config_file_path = mock.MagicMock(side_effect=Exception)
        retcode = self.shell.run(['--config', self.CONFIG_FILE, 'whoami'])
        self.assertEqual('Unable to retrieve currently logged-in user',
                         self.stdout.getvalue().strip())
        self.assertEqual(retcode, 0)
def runTest ( self , mock_cli ) : mock_cli . return_value . _get_config_file_path = mock . MagicMock ( side_effect = Exception ) retcode = self . shell . run ( [ '--config' , self . CONFIG_FILE , 'whoami' ] ) self . assertEqual ( 'Unable to retrieve currently logged-in user' , self . stdout . getvalue ( ) . strip ( ) ) self . assertEqual ( retcode , 0 )
Test 'st2 whoami' ability to detect unhandled exceptions
Test ' st2 whoami ' ability to detect unhandled exceptions
'''Test 'st2 whoami' ability to detect unhandled exceptions
        ''' # Only mocking "BaseCLIApp" here in order to generate an exception for this specific test
self
mock_cli