From 1b2d6aff6ccf72fdb292a1f05bb41bf9633a8f55 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Tue, 25 Apr 2023 04:03:48 -0600 Subject: refactor tests and add more typing --- tests/sample_files/config/__init__.py | 0 tests/sample_files/config/default.yaml | 23 +++++++++++ .../sample_files/config/default_missing_dirs.yaml | 17 ++++++++ .../config/default_missing_mandatory_key.yaml | 24 ++++++++++++ .../config/default_missing_root_dir.yaml | 18 +++++++++ tests/sample_files/config/multiple_default.yaml | 45 ++++++++++++++++++++++ .../config/multiple_default_one_doc_error.yaml | 39 +++++++++++++++++++ 7 files changed, 166 insertions(+) create mode 100644 tests/sample_files/config/__init__.py create mode 100644 tests/sample_files/config/default.yaml create mode 100644 tests/sample_files/config/default_missing_dirs.yaml create mode 100644 tests/sample_files/config/default_missing_mandatory_key.yaml create mode 100644 tests/sample_files/config/default_missing_root_dir.yaml create mode 100644 tests/sample_files/config/multiple_default.yaml create mode 100644 tests/sample_files/config/multiple_default_one_doc_error.yaml (limited to 'tests/sample_files/config') diff --git a/tests/sample_files/config/__init__.py b/tests/sample_files/config/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/sample_files/config/default.yaml b/tests/sample_files/config/default.yaml new file mode 100644 index 0000000..08121a6 --- /dev/null +++ b/tests/sample_files/config/default.yaml @@ -0,0 +1,23 @@ +%YAML 1.2 +--- +define: &root "$PYSSG_HOME/pyssg/site_example/" + +title: "Example site" +path: + src: !join [*root, "src"] + dst: !join [*root, "dst"] + plt: !join [*root, "plt"] + db: !join [*root, ".files"] +url: + main: "https://example.com" +fmt: + date: "%a, %b %d, %Y @ %H:%M %Z" +dirs: + /: + cfg: + plt: "page.html" + tags: False + index: False + rss: False + sitemap: False +... \ No newline at end of file diff --git a/tests/sample_files/config/default_missing_dirs.yaml b/tests/sample_files/config/default_missing_dirs.yaml new file mode 100644 index 0000000..03ee35a --- /dev/null +++ b/tests/sample_files/config/default_missing_dirs.yaml @@ -0,0 +1,17 @@ +%YAML 1.2 +--- +define: &root "$PYSSG_HOME/pyssg/site_example/" + +title: "Example site" +path: + src: !join [*root, "src"] + dst: !join [*root, "dst"] + plt: !join [*root, "plt"] + db: !join [*root, ".files"] +url: + main: "https://example.com" +fmt: + date: "%a, %b %d, %Y @ %H:%M %Z" +dirs: +# test missing dirs (doesn't have any) +... \ No newline at end of file diff --git a/tests/sample_files/config/default_missing_mandatory_key.yaml b/tests/sample_files/config/default_missing_mandatory_key.yaml new file mode 100644 index 0000000..b5554f7 --- /dev/null +++ b/tests/sample_files/config/default_missing_mandatory_key.yaml @@ -0,0 +1,24 @@ +%YAML 1.2 +--- +define: &root "$PYSSG_HOME/pyssg/site_example/" + +# test missing mandatory key +# title: "Example site" +path: + src: !join [*root, "src"] + dst: !join [*root, "dst"] + plt: !join [*root, "plt"] + db: !join [*root, ".files"] +url: + main: "https://example.com" +fmt: + date: "%a, %b %d, %Y @ %H:%M %Z" +dirs: + /: + cfg: + plt: "page.html" + tags: False + index: False + rss: False + sitemap: False +... \ No newline at end of file diff --git a/tests/sample_files/config/default_missing_root_dir.yaml b/tests/sample_files/config/default_missing_root_dir.yaml new file mode 100644 index 0000000..896e141 --- /dev/null +++ b/tests/sample_files/config/default_missing_root_dir.yaml @@ -0,0 +1,18 @@ +%YAML 1.2 +--- +define: &root "$PYSSG_HOME/pyssg/site_example/" + +title: "Example site" +path: + src: !join [*root, "src"] + dst: !join [*root, "dst"] + plt: !join [*root, "plt"] + db: !join [*root, ".files"] +url: + main: "https://example.com" +fmt: + date: "%a, %b %d, %Y @ %H:%M %Z" +dirs: +# test missing "/" dir in specific + something: +... \ No newline at end of file diff --git a/tests/sample_files/config/multiple_default.yaml b/tests/sample_files/config/multiple_default.yaml new file mode 100644 index 0000000..54954b1 --- /dev/null +++ b/tests/sample_files/config/multiple_default.yaml @@ -0,0 +1,45 @@ +%YAML 1.2 +--- +define: &root "$PYSSG_HOME/pyssg/site_example/" + +title: "Example site" +path: + src: !join [*root, "src"] + dst: !join [*root, "dst"] + plt: !join [*root, "plt"] + db: !join [*root, ".files"] +url: + main: "https://example.com" +fmt: + date: "%a, %b %d, %Y @ %H:%M %Z" +dirs: + /: + cfg: + plt: "page.html" + tags: False + index: False + rss: False + sitemap: False +... +--- +define: &root "$PYSSG_HOME/pyssg/site_example/" + +title: "Example site" +path: + src: !join [*root, "src"] + dst: !join [*root, "dst"] + plt: !join [*root, "plt"] + db: !join [*root, ".files"] +url: + main: "https://example.com" +fmt: + date: "%a, %b %d, %Y @ %H:%M %Z" +dirs: + /: + cfg: + plt: "page.html" + tags: False + index: False + rss: False + sitemap: False +... \ No newline at end of file diff --git a/tests/sample_files/config/multiple_default_one_doc_error.yaml b/tests/sample_files/config/multiple_default_one_doc_error.yaml new file mode 100644 index 0000000..44d9beb --- /dev/null +++ b/tests/sample_files/config/multiple_default_one_doc_error.yaml @@ -0,0 +1,39 @@ +%YAML 1.2 +--- +define: &root "$PYSSG_HOME/pyssg/site_example/" + +title: "Example site" +path: + src: !join [*root, "src"] + dst: !join [*root, "dst"] + plt: !join [*root, "plt"] + db: !join [*root, ".files"] +url: + main: "https://example.com" +fmt: + date: "%a, %b %d, %Y @ %H:%M %Z" +dirs: + /: + cfg: + plt: "page.html" + tags: False + index: False + rss: False + sitemap: False +... +--- +define: &root "$PYSSG_HOME/pyssg/site_example/" + +title: "Example site" +path: + src: !join [*root, "src"] + dst: !join [*root, "dst"] + plt: !join [*root, "plt"] + db: !join [*root, ".files"] +url: + main: "https://example.com" +fmt: + date: "%a, %b %d, %Y @ %H:%M %Z" +dirs: + # just removing all paths as it will cause an error +... \ No newline at end of file -- cgit v1.2.3-54-g00ecf