Skip to content

Commit eb17d06

Browse files
committed
- Project file created dynamically.
- Test for no project file. issue #73
1 parent 563fbe5 commit eb17d06

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/test_cli/test_api/.minos-project.yaml

Whitespace-only changes.

tests/test_cli/test_api/test_new.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121

2222

2323
class TestNew(unittest.TestCase):
24+
def setUp(self) -> None:
25+
self.minos_project_file = Path.cwd() / ".minos-project.yaml"
26+
self.minos_project_file.touch()
27+
28+
def tearDown(self) -> None:
29+
if self.minos_project_file.exists():
30+
self.minos_project_file.unlink()
31+
2432
def test_main(self):
2533
self.assertEqual(__main__.main, main)
2634

@@ -44,6 +52,18 @@ def test_new_microservice(self) -> None:
4452

4553
self.assertEqual(1, mock.call_count)
4654

55+
def test_new_microservice_no_project_file(self) -> None:
56+
self.minos_project_file.unlink()
57+
58+
with TemporaryDirectory() as tmp_dir_name:
59+
path = Path(tmp_dir_name) / "product"
60+
with patch("minos.cli.TemplateProcessor.render") as mock:
61+
result = CliRunner().invoke(app, ["new", "microservice", str(path)])
62+
63+
self.assertEqual(1, result.exit_code)
64+
65+
self.assertEqual(0, mock.call_count)
66+
4767

4868
if __name__ == "__main__":
4969
unittest.main()

0 commit comments

Comments
 (0)