Skip to content

Commit

Permalink
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Dec 2, 2023
1 parent 2ae1e25 commit 79f6524
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions tests/plugin/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,13 @@ def app() -> FlaskClient:

@patch("cosmos.plugin.open_file")
def test_dbt_docs(mock_open_file, monkeypatch, app):

def conf_get(section, key, *args, **kwargs):
if section == "cosmos" and key == "dbt_docs_dir":
return "path/to/docs/dir"
else:
return conf.get(section, key, *args, **kwargs)

monkeypatch.setattr(
"cosmos.plugin.conf",
"get",
conf_get
)
monkeypatch.setattr("cosmos.plugin.conf", "get", conf_get)

mock_open_file.return_value = "<head></head><body></body>"

Expand All @@ -55,18 +50,13 @@ def conf_get(section, key, *args, **kwargs):
@patch("cosmos.plugin.open_file")
@pytest.mark.parametrize("artifact", ["dbt_docs_index.html", "manifest.json", "catalog.json"])
def test_dbt_docs_artifact(mock_open_file, monkeypatch, app, artifact):

def conf_get(section, key, *args, **kwargs):
if section == "cosmos" and key == "dbt_docs_dir":
return "path/to/docs/dir"
else:
return conf.get(section, key, *args, **kwargs)

monkeypatch.setattr(
"cosmos.plugin.conf",
"get",
conf_get
)
monkeypatch.setattr("cosmos.plugin.conf", "get", conf_get)

mock_open_file.return_value = ""
response = app.get(f"/cosmos/{artifact}")
Expand All @@ -76,18 +66,13 @@ def conf_get(section, key, *args, **kwargs):

@pytest.mark.parametrize("artifact", ["dbt_docs_index.html", "manifest.json", "catalog.json"])
def test_dbt_docs_artifact_missing(app, artifact, monkeypatch):

def conf_get(section, key, *args, **kwargs):
if section == "cosmos":
raise AirflowConfigException
else:
return conf.get(section, key, *args, **kwargs)

monkeypatch.setattr(
"cosmos.plugin.conf",
"get",
conf_get
)
monkeypatch.setattr("cosmos.plugin.conf", "get", conf_get)

response = app.get(f"/cosmos/{artifact}")
assert response.status_code == 404

0 comments on commit 79f6524

Please sign in to comment.