2020from wfcommons .wfchef .chef import install_recipe
2121from wfcommons .wfchef .chef import uninstall_recipe
2222from wfcommons .wfchef .chef import ls_recipe
23+ from wfcommons import WorkflowGenerator
2324
2425
2526class TestWfChef :
2627
2728 @pytest .mark .unit
28- def test_create_recipe (self ) -> None :
29+ def test_recipe_management_functions (self ) -> None :
2930 """
3031 Just calling the create_recipe function from chef.py directly (i.e., bypassing main())
3132 """
@@ -110,6 +111,18 @@ def test_create_recipe(self) -> None:
110111 sys .stderr .write (f"✗ Failed to import recipe: { e } \n " )
111112 raise
112113
114+ # Verify the recipe can be used
115+ sys .stderr .write ("\n " + "=" * 60 + "\n " )
116+ sys .stderr .write ("Testing the recipe usage...\n " )
117+ sys .stderr .write ("=" * 60 + "\n " )
118+ try :
119+ generator = WorkflowGenerator (SomenameRecipe .from_num_tasks (250 ))
120+ generator .build_workflow ()
121+ except Exception as e :
122+ sys .stderr .write (f"✗ Failed to use installed recipe: { e } \n " )
123+ raise
124+
125+
113126 # Uninstall the recipe
114127 sys .stderr .write ("\n " + "=" * 60 + "\n " )
115128 sys .stderr .write ("Uninstalling the recipe...\n " )
@@ -123,14 +136,16 @@ def test_create_recipe(self) -> None:
123136 sys .stderr .write ("=" * 60 + "\n " )
124137 ls_recipe ()
125138
139+ # Verify the recipe can be used
126140 sys .stderr .write ("\n " + "=" * 60 + "\n " )
127- sys .stderr .write ("TEST COMPLETED SUCCESSFULLY \n " )
141+ sys .stderr .write ("Testing the recipe usage after an uninstall... \n " )
128142 sys .stderr .write ("=" * 60 + "\n " )
129-
130-
131- # TODO: Do more extensive tests
132- # - Install/Uninstall the recipe
133- # - Use the recipe
143+ try :
144+ generator = WorkflowGenerator (SomenameRecipe .from_num_tasks (250 ))
145+ generator .build_workflow ()
146+ raise Exception ("Should not be able to use a recipe after an uninstall" )
147+ except Exception as e :
148+ pass
134149
135150
136151
0 commit comments