Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwwarren committed Apr 23, 2024
1 parent b51074c commit 43d07e9
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import shutil
import uuid
from tempfile import gettempdir
from tempfile import NamedTemporaryFile
from unittest import mock
from unittest import TestCase

Expand Down Expand Up @@ -57,6 +58,39 @@ def test_regenerate_template_no_args(self):
)


@pytest.mark.usefixtures("tmp_path")
def test_create_data_no_api_key(tmp_path):
runner = CliRunner()
with runner.isolated_filesystem(temp_dir=tmp_path) as td:
with (
NamedTemporaryFile(dir=td, delete=False) as tmp_data,
NamedTemporaryFile(dir=td, delete=False) as tmp_template,
):
tmp_data.write(b"{}")
tmp_data.close()
tmp_template.write(b"{}")
tmp_template.close()

result = runner.invoke(
import_config,
[
"create-data",
"-d",
f"{tmp_data.name}",
"-m",
f"{tmp_template.name}",
"-p",
"testproj",
],
catch_exceptions=False,
)
assert result.exit_code == 2
assert (
"Error: CLOUDTRUTH_API_KEY environment variable is required."
in result.output
)


@pytest.mark.usefixtures("tmp_path")
def test_cli_process_configs_dotenv(tmp_path):
runner = CliRunner()
Expand Down

0 comments on commit 43d07e9

Please sign in to comment.