fix: formatting
This commit is contained in:
parent
0c3d0a6149
commit
bae2a2c126
1 changed files with 9 additions and 8 deletions
17
run.py
17
run.py
|
@ -31,7 +31,9 @@ def get_env(name) -> str:
|
|||
env = FTEST_AUTH = os.environ.get(name)
|
||||
logger.info(f"Environment: {name}: {env}")
|
||||
if env is None:
|
||||
raise Exception(f"Please set environment variable {name}. See https://git.batsense.net/ForgeFlux/webfinger-test#environment-variables")
|
||||
raise Exception(
|
||||
f"Please set environment variable {name}. See https://git.batsense.net/ForgeFlux/webfinger-test#environment-variables"
|
||||
)
|
||||
return env
|
||||
|
||||
|
||||
|
@ -69,7 +71,7 @@ def test_main_params(resp):
|
|||
assert "subject" in resp, "Parameter 'subject' is not present in WebFinger response"
|
||||
assert "links" in resp, "Parameter 'links' is not present in WebFinger response"
|
||||
logger.info(
|
||||
"[SUCCESS] WebFinger response has 'subject', 'aliases' and 'links' parameters'"
|
||||
"[SUCCESS] WebFinger response has 'subject', 'aliases' and 'links' parameters"
|
||||
)
|
||||
|
||||
|
||||
|
@ -121,9 +123,9 @@ def test_subject(resp):
|
|||
|
||||
def test_access_control_allow_origin(resp):
|
||||
# request.headers is case insensitive
|
||||
assert resp.headers[
|
||||
"access-control-allow-origin"
|
||||
] == "*", "Access-Control-Allow-Origin header should be '*' to allow any domain to access the resource with CORS. Please see https://www.rfc-editor.org/rfc/rfc7033.html#section-5"
|
||||
assert (
|
||||
resp.headers["access-control-allow-origin"] == "*"
|
||||
), "Access-Control-Allow-Origin header should be '*' to allow any domain to access the resource with CORS. Please see https://www.rfc-editor.org/rfc/rfc7033.html#section-5"
|
||||
logger.info("[SUCESS] WebFinger endpoint is configured correctly for CORS")
|
||||
|
||||
|
||||
|
@ -133,9 +135,9 @@ if __name__ == "__main__":
|
|||
resp = query_webfinger()
|
||||
json = resp.json()
|
||||
score += 1
|
||||
|
||||
|
||||
success = []
|
||||
failures = { }
|
||||
failures = {}
|
||||
|
||||
try:
|
||||
test_main_params(json)
|
||||
|
@ -168,7 +170,6 @@ if __name__ == "__main__":
|
|||
logger.error(e)
|
||||
failures["test_access_control_allow_origin"] = e
|
||||
|
||||
|
||||
print("\n\n===============")
|
||||
if score == max_score:
|
||||
print("All tests passed")
|
||||
|
|
Loading…
Reference in a new issue