Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/unit tests #110

Merged
merged 3 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/www/views/test_views_rendered.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def test_user_defined_filter_and_macros_raise_error(admin_client, create_dag_run
resp = admin_client.get(url, follow_redirects=True)
assert resp.status_code == 200

resp_html: str = resp.data.decode("utf-8")
resp_html: str = resp.text
assert "echo Hello Apache Airflow" not in resp_html
assert (
"Webserver does not have access to User-defined Macros or Filters when "
Expand Down
6 changes: 3 additions & 3 deletions tests/www/views/test_views_robots.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@

def test_robots(viewer_client):
resp = viewer_client.get("/robots.txt", follow_redirects=True)
assert resp.data.decode("utf-8") == "User-agent: *\nDisallow: /\n"
assert resp.text == "User-agent: *\nDisallow: /\n"


def test_deployment_warning_config(admin_client):
warn_text = "webserver.warn_deployment_exposure"
admin_client.get("/robots.txt", follow_redirects=True)
resp = admin_client.get("", follow_redirects=True)
assert warn_text in resp.data.decode("utf-8")
assert warn_text in resp.text

with conf_vars({("webserver", "warn_deployment_exposure"): "False"}):
admin_client.get("/robots.txt", follow_redirects=True)
resp = admin_client.get("/robots.txt", follow_redirects=True)
assert warn_text not in resp.data.decode("utf-8")
assert warn_text not in resp.text
4 changes: 2 additions & 2 deletions tests/www/views/test_views_task_norun.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_task_view_no_task_instance(admin_client):
url = f"/task?task_id=runme_0&dag_id=example_bash_operator&execution_date={DEFAULT_VAL}"
resp = admin_client.get(url, follow_redirects=True)
assert resp.status_code == 200
html = resp.data.decode("utf-8")
html = resp.text
assert "<h5>No Task Instance Available</h5>" in html
assert "<h5>Task Instance Attributes</h5>" not in html

Expand All @@ -50,5 +50,5 @@ def test_rendered_templates_view_no_task_instance(admin_client):
url = f"/rendered-templates?task_id=runme_0&dag_id=example_bash_operator&execution_date={DEFAULT_VAL}"
resp = admin_client.get(url, follow_redirects=True)
assert resp.status_code == 200
html = resp.data.decode("utf-8")
html = resp.text
assert "Rendered Template" in html