Skip to content

Commit

Permalink
add some tests for babelize generate
Browse files Browse the repository at this point in the history
  • Loading branch information
mcflugen committed Mar 7, 2024
1 parent d72913e commit 5e5f544
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def test_cli(session: nox.Session) -> None:
session.run("babelize", "init", "--help")
session.run("babelize", "update", "--help")
session.run("babelize", "generate", "--help")
session.run("babelize", "generate")


@nox.session
Expand Down
12 changes: 12 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
"""Test the babelizer command-line interface"""

import tomllib

from click.testing import CliRunner

from babelizer.cli import babelize
from babelizer.metadata import BabelMetadata


def test_help():
Expand Down Expand Up @@ -53,6 +56,15 @@ def test_generate_noargs():
assert result.exit_code == 0


def test_generate_gives_valid_toml():
runner = CliRunner()
result = runner.invoke(babelize, ["generate"])
assert result.exit_code == 0

config = tomllib.loads(result.output)
BabelMetadata.validate(config)


def test_init_noargs():
runner = CliRunner()
result = runner.invoke(babelize, ["init"])
Expand Down

0 comments on commit 5e5f544

Please sign in to comment.