@@ -4513,6 +4513,60 @@ def test_add_catalog(self, project_dir):
45134513 data = yaml .safe_load (config_path .read_text ())
45144514 assert len (data ["catalogs" ]) == 1
45154515 assert data ["catalogs" ][0 ]["url" ] == "https://example.com/new-catalog.json"
4516+ assert data ["catalogs" ][0 ]["priority" ] == 1
4517+ assert data ["catalogs" ][0 ]["install_allowed" ] is True
4518+ assert data ["catalogs" ][0 ]["description" ] == ""
4519+
4520+ def test_add_catalog_accepts_metadata_overrides (self , project_dir ):
4521+ from specify_cli .workflows .catalog import WorkflowCatalog
4522+
4523+ catalog = WorkflowCatalog (project_dir )
4524+ catalog .add_catalog (
4525+ "https://example.com/new-catalog.json" ,
4526+ "my-catalog" ,
4527+ priority = 7 ,
4528+ install_allowed = False ,
4529+ description = "Workflow source" ,
4530+ )
4531+
4532+ config_path = project_dir / ".specify" / "workflow-catalogs.yml"
4533+ data = yaml .safe_load (config_path .read_text ())
4534+ assert data ["catalogs" ][0 ] == {
4535+ "name" : "my-catalog" ,
4536+ "url" : "https://example.com/new-catalog.json" ,
4537+ "priority" : 7 ,
4538+ "install_allowed" : False ,
4539+ "description" : "Workflow source" ,
4540+ }
4541+
4542+ def test_catalog_add_cli_accepts_metadata_options (self , project_dir , monkeypatch ):
4543+ from typer .testing import CliRunner
4544+ from specify_cli import app
4545+
4546+ monkeypatch .chdir (project_dir )
4547+ result = CliRunner ().invoke (
4548+ app ,
4549+ [
4550+ "workflow" ,
4551+ "catalog" ,
4552+ "add" ,
4553+ "https://example.com/new-catalog.json" ,
4554+ "--name" ,
4555+ "my-catalog" ,
4556+ "--priority" ,
4557+ "7" ,
4558+ "--no-install-allowed" ,
4559+ "--description" ,
4560+ "Workflow source" ,
4561+ ],
4562+ )
4563+
4564+ assert result .exit_code == 0 , result .output
4565+ config_path = project_dir / ".specify" / "workflow-catalogs.yml"
4566+ data = yaml .safe_load (config_path .read_text ())
4567+ assert data ["catalogs" ][0 ]["priority" ] == 7
4568+ assert data ["catalogs" ][0 ]["install_allowed" ] is False
4569+ assert data ["catalogs" ][0 ]["description" ] == "Workflow source"
45164570
45174571 def test_add_catalog_duplicate_rejected (self , project_dir ):
45184572 from specify_cli .workflows .catalog import WorkflowCatalog , WorkflowValidationError
@@ -4959,6 +5013,61 @@ def test_add_catalog(self, project_dir):
49595013 data = yaml .safe_load (config_path .read_text ())
49605014 assert len (data ["catalogs" ]) == 1
49615015 assert data ["catalogs" ][0 ]["url" ] == "https://example.com/new-steps.json"
5016+ assert data ["catalogs" ][0 ]["priority" ] == 1
5017+ assert data ["catalogs" ][0 ]["install_allowed" ] is True
5018+ assert data ["catalogs" ][0 ]["description" ] == ""
5019+
5020+ def test_add_catalog_accepts_metadata_overrides (self , project_dir ):
5021+ from specify_cli .workflows .catalog import StepCatalog
5022+
5023+ catalog = StepCatalog (project_dir )
5024+ catalog .add_catalog (
5025+ "https://example.com/new-steps.json" ,
5026+ "my-steps" ,
5027+ priority = 7 ,
5028+ install_allowed = False ,
5029+ description = "Step source" ,
5030+ )
5031+
5032+ config_path = project_dir / ".specify" / "step-catalogs.yml"
5033+ data = yaml .safe_load (config_path .read_text ())
5034+ assert data ["catalogs" ][0 ] == {
5035+ "name" : "my-steps" ,
5036+ "url" : "https://example.com/new-steps.json" ,
5037+ "priority" : 7 ,
5038+ "install_allowed" : False ,
5039+ "description" : "Step source" ,
5040+ }
5041+
5042+ def test_catalog_add_cli_accepts_metadata_options (self , project_dir , monkeypatch ):
5043+ from typer .testing import CliRunner
5044+ from specify_cli import app
5045+
5046+ monkeypatch .chdir (project_dir )
5047+ result = CliRunner ().invoke (
5048+ app ,
5049+ [
5050+ "workflow" ,
5051+ "step" ,
5052+ "catalog" ,
5053+ "add" ,
5054+ "https://example.com/new-steps.json" ,
5055+ "--name" ,
5056+ "my-steps" ,
5057+ "--priority" ,
5058+ "7" ,
5059+ "--no-install-allowed" ,
5060+ "--description" ,
5061+ "Step source" ,
5062+ ],
5063+ )
5064+
5065+ assert result .exit_code == 0 , result .output
5066+ config_path = project_dir / ".specify" / "step-catalogs.yml"
5067+ data = yaml .safe_load (config_path .read_text ())
5068+ assert data ["catalogs" ][0 ]["priority" ] == 7
5069+ assert data ["catalogs" ][0 ]["install_allowed" ] is False
5070+ assert data ["catalogs" ][0 ]["description" ] == "Step source"
49625071
49635072 def test_add_catalog_empty_yaml_file (self , project_dir ):
49645073 """An empty YAML config file should be treated as empty, not corrupted."""
0 commit comments