File tree Expand file tree Collapse file tree
tools/cloudharness-test/cloudharness_test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import os
22import logging
3- import requests
43
54import schemathesis as st
5+ st .experimental .OPEN_API_3_1 .enable ()
66
77from cloudharness .auth import get_token
88
2020 logging .exception ("The local schema file %s cannot be loaded. Attempting loading from URL" , openapi_uri )
2121
2222 if not schema :
23- # remote testing: might be /api/openapi.json or /openapi.json
23+ # Try app_url /openapi.json
2424 try :
25- openapi_uri = openapi_uri = app_url + "/openapi.json"
25+ openapi_uri = app_url . rstrip ( "/" ) + "/openapi.json"
2626 logging .info ("Using openapi spec at %s" , openapi_uri )
2727 schema = st .from_uri (openapi_uri )
2828 except st .exceptions .SchemaError :
29- # Use alternative configuration
29+ logging .warning ("Failed to load schema from %s" , openapi_uri )
30+
31+ # Then try app_url/api/openapi.json
3032 try :
31- openapi_uri = app_url .replace ("/api" , "" ) + "/openapi.json"
32- print ( requests . get ( openapi_uri ) )
33+ openapi_uri = app_url .rstrip ("/" ) + "/api /openapi.json"
34+ logging . info ( "Using openapi spec at %s" , openapi_uri )
3335 schema = st .from_uri (openapi_uri )
3436 except st .exceptions .SchemaError as e :
3537 raise Exception (
You can’t perform that action at this time.
0 commit comments