-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add first test battery * Clean github env vars * Fix CMD in Dockerfile * Remove useless import
- Loading branch information
Showing
10 changed files
with
65 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
.venv | ||
publish.sh | ||
main.sh | ||
__pycache__ |
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
Empty file.
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
Jinja2 >= "3.0.3" | ||
pyaml >= "20.4.0" | ||
pytest >= "7.0.1" | ||
loguru >= "0.5.3" | ||
supermutes >= "0.2.5" |
Empty file.
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,6 @@ | ||
<!-- Space: Japan --> | ||
<!-- Parent: Football --> | ||
<!-- Parent: New Team --> | ||
<!-- Title: I have Mark Lenders --> | ||
|
||
And you don't. |
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 @@ | ||
# I DON'T HAVE MARK HEADERS |
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,44 @@ | ||
import os | ||
import pytest | ||
|
||
import mark2confluence.main as main | ||
|
||
RESOURCE_DIR = "tests/resources" | ||
|
||
def clean_github_environment_variables(): | ||
if(os.getenv("CI", False)): | ||
for env_var in os.environ.keys(): | ||
if env_var.startswith("GITHUB"): | ||
os.environ.pop(env_var) | ||
|
||
def test_load_vars_without_env(): | ||
clean_github_environment_variables() | ||
main.load_vars() | ||
assert main.cfg.inputs == main.DEFAULT_INPUTS | ||
assert main.cfg.github == main.DEFAULT_GITHUB | ||
|
||
def test_load_env_prefixes(): | ||
prefixes = main.ENV_PREFIXES | ||
os.environ[f"{prefixes['inputs']}DOC_DIR_PATTERN"] = "foo" | ||
os.environ[f"{prefixes['github']}REPOSITORY"] = "foo" | ||
os.environ[f"{prefixes['actions']}FOO"] = "foo" | ||
os.environ[f"{prefixes['runner']}FOO"] = "foo" | ||
main.load_vars() | ||
assert main.cfg.inputs["DOC_DIR_PATTERN"] == "foo" | ||
assert main.cfg.github["REPOSITORY"] == "foo" | ||
assert main.cfg.actions["FOO"] == "foo" | ||
assert main.cfg.runner["FOO"] == "foo" | ||
|
||
def test_has_mark_headers(): | ||
assert main.has_mark_headers(f"{RESOURCE_DIR}/markdown/with_mark_headers.md") | ||
assert not main.has_mark_headers(f"{RESOURCE_DIR}/markdown/without_mark_headers.md") | ||
|
||
|
||
def test_check_header_template(): | ||
assert main.check_header_template("Valid Jinja2 {{ var }}") | ||
with pytest.raises(SystemExit, match="1"): | ||
main.check_header_template("{{") | ||
|
||
|
||
def test_default_header_template(): | ||
assert main.check_header_template(main.DEFAULT_INPUTS["HEADER_TEMPLATE"]) |