Skip to content

Commit

Permalink
Add an integration test for successful badge generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Dec 15, 2023
1 parent 340677b commit 0955f2e
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,45 @@ async def test_summary_show_validation(envsonschema, always_valid):
], run_stderr.decode()


@pytest.mark.asyncio
async def test_badges(envsonschema, tmp_path):
raw = """
{"description":"one","schema":{"type": "integer"},"tests":[{"description":"valid:1","instance":12},{"description":"valid:0","instance":12.5}]}
{"description":"two","schema":{"type": "string"},"tests":[{"description":"crash:1","instance":"{}"}]}
{"description":"crash:1","schema":{"type": "number"},"tests":[{"description":"three","instance":"{}"}, {"description": "another", "instance": 37}]}
{"description":"four","schema":{"type": "array"},"tests":[{"description":"skip:message=foo","instance":""}]}
{"description":"skip:message=bar","schema":{"type": "boolean"},"tests":[{"description":"five","instance":""}]}
{"description":"six","schema":{"type": "array"},"tests":[{"description":"error:message=boom","instance":""}, {"description":"valid:0", "instance":12}]}
{"description":"error:message=boom","schema":{"type": "array"},"tests":[{"description":"seven","instance":""}]}
""" # noqa: E501
run_stdout, _ = await run(
sys.executable,
"-m",
"bowtie",
"run",
"-i",
envsonschema,
stdin=dedent(raw.strip("\n")),
)

badges = tmp_path / "badges"
stdout, stderr = await run(
sys.executable,
"-m",
"bowtie",
"badges",
badges,
stdin=run_stdout,
)

assert {path.relative_to(badges) for path in badges.rglob("*")} == {
Path("python-envsonschema"),
Path("python-envsonschema/supported_versions.json"),
Path("python-envsonschema/compliance"),
Path("python-envsonschema/compliance/Draft_2020-12.json"),
}


@pytest.mark.asyncio
async def test_badges_nothing_ran(envsonschema, tmp_path):
run_stdout, _ = await run(
Expand Down

0 comments on commit 0955f2e

Please sign in to comment.