44from pathlib import Path
55import shutil
66from cli_test_utils import run_cli
7+ from agentstack import conf
8+ from agentstack import frameworks
9+ from agentstack .cli import init_project
710from agentstack .templates import get_all_templates
811
912BASE_PATH = Path (__file__ ).parent
1013
14+
1115class CLIInitTest (unittest .TestCase ):
1216 def setUp (self ):
1317 self .framework = os .getenv ('TEST_FRAMEWORK' )
@@ -21,9 +25,20 @@ def setUp(self):
2125 def tearDown (self ):
2226 shutil .rmtree (self .project_dir , ignore_errors = True )
2327
24- @parameterized .expand ([(template .name , ) for template in get_all_templates ()])
28+ @parameterized .expand ([(template .name ,) for template in get_all_templates ()])
2529 def test_init_command (self , template_name : str ):
2630 """Test the 'init' command to create a project directory."""
2731 result = run_cli ('init' , 'test_project' , '--template' , template_name )
2832 self .assertEqual (result .returncode , 0 )
2933 self .assertTrue ((self .project_dir / 'test_project' ).exists ())
34+
35+ @parameterized .expand ([(k , v ) for k , v in frameworks .ALIASED_FRAMEWORKS .items ()])
36+ def test_init_command_aliased_framework_empty_project (self , alias : str , framework : str ):
37+ """Test the 'init' command with an aliased framework."""
38+ if framework != self .framework :
39+ self .skipTest (f"{ alias } is not related to this framework" )
40+
41+ init_project (slug_name = 'test_project' , template = 'empty' , framework = alias )
42+ conf .set_path (self .project_dir / 'test_project' )
43+ config = conf .ConfigFile ()
44+ assert config .framework == framework
0 commit comments