def test_get_user_agent_returns_correct_value_after_setting_suffix(default_user_agent): settings.set_user_agent_suffix("example-suffix") assert settings.get_user_agent_string() == "{} {}".format( default_user_agent, "example-suffix" ) # reset settings to default settings.set_user_agent_suffix("")
def test_get_user_agent_returns_correct_value_after_setting_suffix( default_user_agent): settings.set_user_agent_suffix("example-suffix") assert settings.get_user_agent_string( ) == f"{default_user_agent} example-suffix" # reset settings to default settings.set_user_agent_suffix("")
def test_get_user_agent_returns_correct_default_value(default_user_agent): assert settings.get_user_agent_string() == default_user_agent # reset settings to default settings.set_user_agent_suffix("")
from code42cli.cmds.trustedactivities import trusted_activities from code42cli.cmds.users import users from code42cli.options import sdk_options # Handle KeyboardInterrupts by just exiting instead of printing out a stack def exit_on_interrupt(signal, frame): click.echo(err=True) sys.exit(1) signal.signal(signal.SIGINT, exit_on_interrupt) # Sets part of the user agent string that py42 attaches to requests for the purposes of # identifying CLI users. set_user_agent_suffix(PRODUCT_NAME) CONTEXT_SETTINGS = { "help_option_names": ["-h", "--help"], "max_content_width": 200, } @with_plugins(iter_entry_points("code42cli.plugins")) @click.group( cls=ExceptionHandlingGroup, context_settings=CONTEXT_SETTINGS, help=BANNER, invoke_without_command=True, no_args_is_help=True, )