chore: use before_request hook for dynamic routes (#14568)

* chore: use before_request hook for dynamic routes

* Shorten hook names

* Introduce with_feature_flags and update thumbnail tests

* Disable test that fails in CI but not locally

* Add test for reports
This commit is contained in:
Ben Reinhart
2021-05-14 12:49:25 -07:00
committed by GitHub
parent f16c708fab
commit 6d9d362ca8
9 changed files with 168 additions and 83 deletions

View File

@@ -20,13 +20,14 @@ from typing import Any
from flask import current_app, url_for
def get_url_host(user_friendly: bool = False) -> str:
if user_friendly:
return current_app.config["WEBDRIVER_BASEURL_USER_FRIENDLY"]
return current_app.config["WEBDRIVER_BASEURL"]
def headless_url(path: str, user_friendly: bool = False) -> str:
base_url = (
current_app.config["WEBDRIVER_BASEURL_USER_FRIENDLY"]
if user_friendly
else current_app.config["WEBDRIVER_BASEURL"]
)
return urllib.parse.urljoin(base_url, path)
return urllib.parse.urljoin(get_url_host(user_friendly=user_friendly), path)
def get_url_path(view: str, user_friendly: bool = False, **kwargs: Any) -> str: