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

        expected_username = self.TOKEN['user']
        args = ['--config', self.CONFIG_FILE, 'login', expected_username]

        mock_gp.getpass = mock.MagicMock(side_effect=Exception)

        self.shell.run(args)
        retcode = self.shell.run(args)

        self.assertTrue('Failed to log in as %s' % expected_username in self.stdout.getvalue())
        self.assertTrue('Logged in as' not in self.stdout.getvalue())
        self.assertEqual(retcode, 0)
Test 'st2 login' ability to detect unhandled exceptions
        
Test 'st2 login' ability to detect unhandled exceptions
Test ' st2 login ' ability to detect unhandled exceptions
def runTest(self, mock_gp):
        expected_username = self.TOKEN['user']
        args = ['--config', self.CONFIG_FILE, 'login', expected_username]
        mock_gp.getpass = mock.MagicMock(side_effect=Exception)
        self.shell.run(args)
        retcode = self.shell.run(args)
        self.assertTrue('Failed to log in as %s' % expected_username in self.stdout.getvalue())
        self.assertTrue('Logged in as' not in self.stdout.getvalue())
        self.assertEqual(retcode, 0)
def runTest ( self , mock_gp ) : expected_username = self . TOKEN [ 'user' ] args = [ '--config' , self . CONFIG_FILE , 'login' , expected_username ] mock_gp . getpass = mock . MagicMock ( side_effect = Exception ) self . shell . run ( args ) retcode = self . shell . run ( args ) self . assertTrue ( 'Failed to log in as %s' % expected_username in self . stdout . getvalue ( ) ) self . assertTrue ( 'Logged in as' not in self . stdout . getvalue ( ) ) self . assertEqual ( retcode , 0 )
Test 'st2 login' ability to detect unhandled exceptions
Test ' st2 login ' ability to detect unhandled exceptions
'''Test 'st2 login' ability to detect unhandled exceptions
        '''
self
mock_gp