Skip to content

Commit

Permalink
Updated docs tests with dbt.client.systems calls for file reading
Browse files Browse the repository at this point in the history
  • Loading branch information
mescanne committed Sep 11, 2023
1 parent c17923f commit bab5dc2
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions tests/functional/docs/test_static.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest

from dbt.clients.system import load_file_contents
from dbt.include.global_project import DOCS_INDEX_FILE_PATH
from dbt.tests.util import run_dbt
import os
Expand All @@ -13,24 +14,27 @@ def models(self):
def test_static_generated(self, project):
run_dbt(["docs", "generate", "--static"])

with open(DOCS_INDEX_FILE_PATH) as d:
source_index_html = d.read()
source_index_html = load_file_contents(DOCS_INDEX_FILE_PATH)

with open(os.path.join(project.project_root, "target", "index.html")) as d:
target_index_html = d.read()
target_index_html = load_file_contents(
os.path.join(project.project_root, "target", "index.html")
)

# Validate index.html was copied correctly
assert len(target_index_html) == len(source_index_html)
assert hash(target_index_html) == hash(source_index_html)

with open(os.path.join(project.project_root, "target", "manifest.json")) as d:
manifest_data = d.read()
manifest_data = load_file_contents(
os.path.join(project.project_root, "target", "manifest.json")
)

with open(os.path.join(project.project_root, "target", "catalog.json")) as d:
catalog_data = d.read()
catalog_data = load_file_contents(
os.path.join(project.project_root, "target", "catalog.json")
)

with open(os.path.join(project.project_root, "target", "static_index.html")) as d:
static_index_html = d.read()
static_index_html = load_file_contents(
os.path.join(project.project_root, "target", "static_index.html")
)

# Calculate expected static_index.html
expected_static_index_html = source_index_html
Expand Down

0 comments on commit bab5dc2

Please sign in to comment.