Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _process_result(self, status):
if status == TestStatus.ERROR:
session.increment_errors()
return
if status == TestStatus.FAILED:
session.increment_failures()
return
if status == TestStatus.PASSED:
session.increment_successes()
def _process_result(self, status):
if status == TestStatus.ERROR:
session.increment_errors()
return
if status == TestStatus.FAILED:
session.increment_failures()
return
if status == TestStatus.PASSED:
session.increment_successes()
MissingMandatoryKeyError,
KeyError,
InvalidPythonCodeError,
) as e:
error_message = "Error loading API spec."
error_message = "{} {}".format(error_message, str(e))
logger.error(error_message)
raise SystemExit(ExitCode.USAGE_ERROR)
try:
write_report(results)
except (BadConfigurationError, InvalidPythonCodeError) as e:
logger.error(e)
raise SystemExit(ExitCode.USAGE_ERROR)
session.exit()
def main(spec_path, output_path, config_path, template, log_level):
"""
Automated Testing and Documentation for your REST API.
SPEC_PATH argument is the API specification file path.
"""
session.start()
logging.basicConfig(level=log_level, format="%(message)s")
logger = logging.getLogger(__name__)
click_preferences = {
"spec_path": spec_path,
"output_path": output_path,
"config_path": config_path,
"template": template,
}
settings.save_preferences(**click_preferences)
scan()
def _build_context(self, results):
return {
"now": datetime.datetime.now().replace(microsecond=0),
"project_name": settings.get("project-name", ""),
"results": results,
"session": session,
}