def test_positive_log_out_from_session(admin_user, target_sat): """Check if session is terminated when user logs out :id: 0ba05f2d-7b83-4b0c-a04c-80e62b7c4cf2 :Steps: 1. Set use_sessions 2. Authenticate, assert credentials are not demanded on next command run 3. Run `hammer auth logout` :expectedresults: The session is terminated """ result = configure_sessions(target_sat) assert result == 0, 'Failed to configure hammer sessions' AuthLogin.basic({'username': admin_user['login'], 'password': password}) result = Auth.with_user().status() assert LOGEDIN_MSG.format(admin_user['login']) in result[0]['message'] # list organizations without supplying credentials assert Org.with_user().list() Auth.logout() result = Auth.with_user().status() assert LOGEDOFF_MSG.format(admin_user['login']) in result[0]['message'] with pytest.raises(CLIReturnCodeError): Org.with_user().list()
def test_positive_log_out_from_session(self): """Check if session is terminated when user logs out :id: 0ba05f2d-7b83-4b0c-a04c-80e62b7c4cf2 :Steps: 1. Set use_sessions 2. Authenticate, assert credentials are not demanded on next command run 3. Run `hammer auth logout` :expectedresults: The session is terminated """ result = configure_sessions() self.assertEqual(result, 0, 'Failed to configure hammer sessions') Auth.login({'username': self.uname_admin, 'password': self.password}) result = Auth.with_user().status() self.assertIn(LOGEDIN_MSG.format(self.uname_admin), result[0][u'message']) # list organizations without supplying credentials with self.assertNotRaises(CLIReturnCodeError): Org.with_user().list() Auth.logout() result = Auth.with_user().status() self.assertIn(LOGEDOFF_MSG.format(self.uname_admin), result[0][u'message']) with self.assertRaises(CLIReturnCodeError): Org.with_user().list()
def test_positive_log_out_from_session(self): """Check if session is terminated when user logs out :id: 0ba05f2d-7b83-4b0c-a04c-80e62b7c4cf2 :Steps: 1. Set use_sessions 2. Authenticate, assert credentials are not demanded on next command run 3. Run `hammer auth logout` :expectedresults: The session is terminated """ result = configure_sessions() self.assertEqual(result, 0, 'Failed to configure hammer sessions') Auth.login({'username': self.uname_admin, 'password': self.password}) result = Auth.with_user().status() self.assertIn( LOGEDIN_MSG.format(self.uname_admin), result[0][u'message'] ) # list organizations without supplying credentials with self.assertNotRaises(CLIReturnCodeError): Org.with_user().list() Auth.logout() result = Auth.with_user().status() self.assertIn( LOGEDOFF_MSG.format(self.uname_admin), result[0][u'message'] ) with self.assertRaises(CLIReturnCodeError): Org.with_user().list()