fix: formatting

This commit is contained in:
Aravinth Manivannan 2023-09-08 16:43:57 +05:30
parent 0c3d0a6149
commit bae2a2c126
Signed by: realaravinth
GPG key ID: F8F50389936984FF

13
run.py
View file

@ -31,7 +31,9 @@ def get_env(name) -> str:
env = FTEST_AUTH = os.environ.get(name) env = FTEST_AUTH = os.environ.get(name)
logger.info(f"Environment: {name}: {env}") logger.info(f"Environment: {name}: {env}")
if env is None: 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 return env
@ -69,7 +71,7 @@ def test_main_params(resp):
assert "subject" in resp, "Parameter 'subject' is not present in WebFinger response" assert "subject" in resp, "Parameter 'subject' is not present in WebFinger response"
assert "links" in resp, "Parameter 'links' is not present in WebFinger response" assert "links" in resp, "Parameter 'links' is not present in WebFinger response"
logger.info( 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): def test_access_control_allow_origin(resp):
# request.headers is case insensitive # request.headers is case insensitive
assert resp.headers[ assert (
"access-control-allow-origin" 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" ), "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") logger.info("[SUCESS] WebFinger endpoint is configured correctly for CORS")
@ -168,7 +170,6 @@ if __name__ == "__main__":
logger.error(e) logger.error(e)
failures["test_access_control_allow_origin"] = e failures["test_access_control_allow_origin"] = e
print("\n\n===============") print("\n\n===============")
if score == max_score: if score == max_score:
print("All tests passed") print("All tests passed")