def test_oauth2_token(self, config, kwargs, cli_args, expected): if 'token_file' in kwargs: tmpf = self.tmpfile_with_content(kwargs['token_file']) kwargs['token_file'] = tmpf.name with self.build_cli_args(cli_args) as args: with self.config_file(config) as config_file: conf = Configuration(conf_file=config_file, cli_args=args, **kwargs) assert conf.get_oauth2_token() == expected
def test_oauth2_token(self, config, kwargs, cli_args, expected): if 'token_file' in kwargs: tmpf = self.tmpfile_with_content(kwargs['token_file']) kwargs['token_file'] = tmpf.name with self.build_cli_args(cli_args) as args: with self.config_file(config) as config_file: conf = Configuration(conf_file=config_file, cli_args=args, **kwargs) assert conf.get_oauth2_token() == expected
def test_oauth2_token(self, config, kwargs, cli_args, login, expected): if 'token_file' in kwargs: tmpf = self.tmpfile_with_content(kwargs['token_file']) kwargs['token_file'] = tmpf.name if login: login_tmpf = self.tmpfile_with_content(login) if 'login_file' == expected: (flexmock(utils).should_receive('get_instance_token_file_name'). with_args('default').and_return(login_tmpf.name)) with self.build_cli_args(cli_args) as args: with self.config_file(config) as config_file: conf = Configuration(conf_file=config_file, cli_args=args, **kwargs) assert conf.get_oauth2_token() == expected