2424from galaxy .tool_util .unittest_utils .parameters import (
2525 parameter_bundle ,
2626 parameter_bundle_for_file ,
27- tool_parameter ,
2827)
2928from galaxy .util .resources import resource_string
3029
@@ -59,7 +58,7 @@ def test_single():
5958def _test_file (file : str , specification = None ):
6059 spec = specification or specification_object ()
6160 combos = spec [file ]
62- tool_parameter_model = tool_parameter (file )
61+ parameter_bundle = parameter_bundle_for_file (file )
6362
6463 assertion_functions = {
6564 "request_valid" : _assert_requests_validate ,
@@ -74,13 +73,13 @@ def _test_file(file: str, specification=None):
7473
7574 for valid_or_invalid , tests in combos .items ():
7675 assertion_function = assertion_functions [valid_or_invalid ]
77- assertion_function (tool_parameter_model , tests )
76+ assertion_function (parameter_bundle , tests )
7877
7978 # Assume request validation will work here.
8079 if "request_internal_valid" not in combos and "request_valid" in combos :
81- _assert_internal_requests_validate (tool_parameter_model , combos ["request_valid" ])
80+ _assert_internal_requests_validate (parameter_bundle , combos ["request_valid" ])
8281 if "request_internal_invalid" not in combos and "request_invalid" in combos :
83- _assert_internal_requests_invalid (tool_parameter_model , combos ["request_invalid" ])
82+ _assert_internal_requests_invalid (parameter_bundle , combos ["request_invalid" ])
8483
8584
8685def _for_each (test : Callable , parameter : ToolParameterT , requests : List [Dict [str , Any ]]) -> None :
@@ -90,31 +89,31 @@ def _for_each(test: Callable, parameter: ToolParameterT, requests: List[Dict[str
9089
9190def _assert_request_validates (parameter : ToolParameterT , request : Dict [str , Any ]) -> None :
9291 try :
93- validate_request (parameter_bundle ( parameter ) , request )
92+ validate_request (parameter , request )
9493 except RequestParameterInvalidException as e :
9594 raise AssertionError (f"Parameter { parameter } failed to validate request { request } . { e } " )
9695
9796
9897def _assert_request_invalid (parameter , request ) -> None :
9998 exc = None
10099 try :
101- validate_request (parameter_bundle ( parameter ) , request )
100+ validate_request (parameter , request )
102101 except RequestParameterInvalidException as e :
103102 exc = e
104103 assert exc is not None , f"Parameter { parameter } didn't result in validation error on request { request } as expected."
105104
106105
107106def _assert_internal_request_validates (parameter , request ) -> None :
108107 try :
109- validate_internal_request (parameter_bundle ( parameter ) , request )
108+ validate_internal_request (parameter , request )
110109 except RequestParameterInvalidException as e :
111110 raise AssertionError (f"Parameter { parameter } failed to validate internal request { request } . { e } " )
112111
113112
114113def _assert_internal_request_invalid (parameter , request ) -> None :
115114 exc = None
116115 try :
117- validate_internal_request (parameter_bundle ( parameter ) , request )
116+ validate_internal_request (parameter , request )
118117 except RequestParameterInvalidException as e :
119118 exc = e
120119 assert (
@@ -124,15 +123,15 @@ def _assert_internal_request_invalid(parameter, request) -> None:
124123
125124def _assert_internal_job_validates (parameter , request ) -> None :
126125 try :
127- validate_internal_job (parameter_bundle ( parameter ) , request )
126+ validate_internal_job (parameter , request )
128127 except RequestParameterInvalidException as e :
129128 raise AssertionError (f"Parameter { parameter } failed to validate internal job description { request } . { e } " )
130129
131130
132131def _assert_internal_job_invalid (parameter , request ) -> None :
133132 exc = None
134133 try :
135- validate_internal_job (parameter_bundle ( parameter ) , request )
134+ validate_internal_job (parameter , request )
136135 except RequestParameterInvalidException as e :
137136 exc = e
138137 assert (
@@ -142,15 +141,15 @@ def _assert_internal_job_invalid(parameter, request) -> None:
142141
143142def _assert_test_case_validates (parameter , test_case ) -> None :
144143 try :
145- validate_test_case (parameter_bundle ( parameter ) , test_case )
144+ validate_test_case (parameter , test_case )
146145 except RequestParameterInvalidException as e :
147146 raise AssertionError (f"Parameter { parameter } failed to validate test_case { test_case } . { e } " )
148147
149148
150149def _assert_test_case_invalid (parameter , test_case ) -> None :
151150 exc = None
152151 try :
153- validate_test_case (parameter_bundle ( parameter ) , test_case )
152+ validate_test_case (parameter , test_case )
154153 except RequestParameterInvalidException as e :
155154 exc = e
156155 assert (
@@ -213,7 +212,7 @@ def encode_val(val: int) -> str:
213212 parameter_spec = specification_object ()
214213 parameter_models_json = {}
215214 for file in parameter_spec .keys ():
216- tool_parameter_model = tool_parameter (file )
215+ tool_parameter_model = parameter_bundle_for_file (file )
217216 parameter_models_json [file ] = tool_parameter_model .dict ()
218217 yaml_str = yaml .safe_dump (parameter_models_json )
219218 with open ("client/src/components/Tool/parameter_models.yml" , "w" ) as f :
0 commit comments