mirror of
https://github.com/pi-hole/FTL.git
synced 2025-12-24 10:08:26 +00:00
Add ability to trace API validator script (off by default)
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -9,13 +9,17 @@
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
import sys
|
||||
import trace
|
||||
from libs.openAPI import openApi
|
||||
from libs.FTLAPI import FTLAPI
|
||||
from libs.responseVerifyer import ResponseVerifyer
|
||||
|
||||
if __name__ == "__main__":
|
||||
TRACE = False
|
||||
|
||||
def main():
|
||||
# OpenAPI specs are split into multiple files, this script extracts the endpoints from them
|
||||
openapi = openApi(base_path = "src/api/docs/content/specs/", api_root = "/api")
|
||||
openapi = openApi(base_path = "src/api/docs/content/specs/", api_root = "/api", trace = TRACE)
|
||||
if not openapi.parse("main.yaml"):
|
||||
exit(1)
|
||||
|
||||
@@ -110,4 +114,22 @@ if __name__ == "__main__":
|
||||
|
||||
# If there are no errors, exit with success
|
||||
print("Everything okay!")
|
||||
exit(0)
|
||||
#exit(0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
if TRACE:
|
||||
tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix],
|
||||
trace=1, count=1)
|
||||
tracer.run('main()')
|
||||
|
||||
# make a report, placing output in the current directory
|
||||
r = tracer.results()
|
||||
print(r.write_results(show_missing=True, coverdir="."))
|
||||
|
||||
# Exit with success
|
||||
exit(0)
|
||||
else:
|
||||
main()
|
||||
|
||||
# Exit with success
|
||||
exit(0)
|
||||
|
||||
Reference in New Issue
Block a user