def test_token_login_already_logged_in(self, tokens_api_mock): with XRDSSTTest() as app: token_controller = TokenController() token_controller.app = app token_controller.load_config = (lambda: self.ss_config) token_controller.get_server_status = ( lambda x, y: StatusTestData.server_status_essentials_complete) token_controller.login() out, err = self.capsys.readouterr() assert 1 == out.count("Token 0 already logged in for 'ssX'") with self.capsys.disabled(): sys.stdout.write(out) sys.stderr.write(err)
def test_token_login(self): with XRDSSTTest() as app: with mock.patch('xrdsst.api.tokens_api.TokensApi.login_token', return_value=TokenTestData.token_login_response): token_controller = TokenController() token_controller.app = app token_controller.load_config = (lambda: self.ss_config) token_controller.get_server_status = ( lambda x, y: StatusTestData. server_status_essentials_complete) token_controller.login() out, err = self.capsys.readouterr() assert 1 == out.count( "Security server 'ssX' token 0 logged in.") with self.capsys.disabled(): sys.stdout.write(out) sys.stderr.write(err)
def step_token_login(self): with XRDSSTTest() as app: token_controller = TokenController() token_controller.app = app token_controller.load_config = (lambda: self.config) token_controller.login()