-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from piercefreeman/feature/hash-static-files
Automatically add sha to static artifacts
- Loading branch information
Showing
15 changed files
with
408 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from pathlib import Path | ||
|
||
from mountaineer.app import AppController | ||
from mountaineer.client_compiler.compile import ClientCompiler | ||
|
||
|
||
def test_build_static_metadata(tmpdir: Path): | ||
app = AppController(view_root=tmpdir) | ||
compiler = ClientCompiler(app=app) | ||
|
||
# Write test files to the view path to determine if we're able | ||
# to parse the whole file tree | ||
static_dir = compiler.view_root.get_managed_static_dir() | ||
|
||
(static_dir / "test_css.css").write_text("CSS_TEXT") | ||
|
||
(static_dir / "nested").mkdir(exist_ok=True) | ||
(static_dir / "nested" / "test_nested.css").write_text("CSS_TEXT") | ||
|
||
# File contents are the same - shas should be the same as well | ||
metadata = compiler._build_static_metadata() | ||
assert "test_css.css" in metadata.static_artifact_shas | ||
assert "nested/test_nested.css" in metadata.static_artifact_shas | ||
assert ( | ||
metadata.static_artifact_shas["test_css.css"] | ||
== metadata.static_artifact_shas["nested/test_nested.css"] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.