Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_multi_quick_check(self):
"""Multi quick check subcommand called."""
args = parse_arguments(["multi_quick_check", "0.0.0.0", "0.0.0.1"])
assert args.func == multi_quick_check
context_parser = subparsers.add_parser("context", help=context.__doc__.rstrip("."))
context_parser.add_argument(
"ip_address", type=ip_address_parameter, help="IP address"
)
context_parser.set_defaults(func=context)
quick_check_parser = subparsers.add_parser(
"quick_check", help=quick_check.__doc__.rstrip(".")
)
quick_check_parser.add_argument(
"ip_address", type=ip_address_parameter, help="IP address"
)
quick_check_parser.set_defaults(func=quick_check)
multi_quick_check_parser = subparsers.add_parser(
"multi_quick_check", help=multi_quick_check.__doc__.rstrip(".")
)
multi_quick_check_parser.add_argument(
"ip_address", type=ip_address_parameter, nargs="+", help="IP address"
)
multi_quick_check_parser.set_defaults(func=multi_quick_check)
actors_parser = subparsers.add_parser("actors", help=actors.__doc__.rstrip("."))
actors_parser.set_defaults(func=actors)
args = parser.parse_args(argv)
if not args.api_key:
config = load_config()
if not config["api_key"]:
prog = os.path.basename(sys.argv[0])
print(
"Error: API key not found.\n\n"
quick_check_parser = subparsers.add_parser(
"quick_check", help=quick_check.__doc__.rstrip(".")
)
quick_check_parser.add_argument(
"ip_address", type=ip_address_parameter, help="IP address"
)
quick_check_parser.set_defaults(func=quick_check)
multi_quick_check_parser = subparsers.add_parser(
"multi_quick_check", help=multi_quick_check.__doc__.rstrip(".")
)
multi_quick_check_parser.add_argument(
"ip_address", type=ip_address_parameter, nargs="+", help="IP address"
)
multi_quick_check_parser.set_defaults(func=multi_quick_check)
actors_parser = subparsers.add_parser("actors", help=actors.__doc__.rstrip("."))
actors_parser.set_defaults(func=actors)
args = parser.parse_args(argv)
if not args.api_key:
config = load_config()
if not config["api_key"]:
prog = os.path.basename(sys.argv[0])
print(
"Error: API key not found.\n\n"
"To fix this problem, please use any of the following methods "
"(in order of precedence):\n"
"- Pass it using the -k/--api-key option.\n"
"- Set it in the GREYNOISE_API_KEY environment variable.\n"
"- Run {!r} to save it to the configuration file.\n".format(