@@ -183,6 +183,109 @@ def test_data_action_create(self, mock_cli_with_parsed_template):
183183 ),
184184 ]
185185
186+ def test_data_action_put (self , mock_cli_with_parsed_template ):
187+ cli , tmpl_data = mock_cli_with_parsed_template
188+
189+ group = get_first (tmpl_data .groups , lambda v : v .name == "test-resource" )
190+ action = get_first (group .actions , lambda v : v .action [0 ] == "update" )
191+
192+ assert action .command == "test-resource"
193+ assert action .action == ["update" ]
194+
195+ assert "linode-cli test-resource update [-h]" in action .usage
196+ assert "resourceId" in action .usage
197+
198+ assert "Update a test resource." == action .summary
199+ assert "Update a test resource." == action .description
200+ assert "https://linode.com" == action .api_documentation_url
201+ assert not action .deprecated
202+
203+ assert len (action .samples ) == 0
204+ assert len (action .filterable_attributes ) == 0
205+
206+ self ._validate_resource_parameters (action )
207+ self ._validate_resource_response_attributes (action )
208+
209+ arg_sections = action .argument_sections
210+ assert len (arg_sections ) == 2
211+
212+ assert arg_sections [0 ].name == ""
213+ assert arg_sections [0 ].entries == [
214+ Argument (
215+ path = "object_field.bar" ,
216+ required = True ,
217+ type = "str" ,
218+ description = "An arbitrary bar." ,
219+ example = "foo" ,
220+ ),
221+ Argument (
222+ path = "boolean_field" ,
223+ required = False ,
224+ type = "bool" ,
225+ description = "An arbitrary boolean." ,
226+ example = "true" ,
227+ ),
228+ Argument (
229+ path = "integer_field" ,
230+ required = False ,
231+ type = "int" ,
232+ description = "An arbitrary integer." ,
233+ ),
234+ Argument (
235+ path = "literal_list" ,
236+ required = False ,
237+ type = "[]str" ,
238+ description = "An arbitrary list of literals." ,
239+ example = "foo" ,
240+ ),
241+ Argument (
242+ path = "object_list" ,
243+ required = False ,
244+ type = "json" ,
245+ is_json = True ,
246+ description = "An arbitrary object." ,
247+ is_parent = True ,
248+ ),
249+ Argument (
250+ path = "string_field" ,
251+ required = False ,
252+ type = "str" ,
253+ description = "An arbitrary string." ,
254+ example = "test string" ,
255+ ),
256+ Argument (
257+ path = "object_field.foo" ,
258+ required = False ,
259+ type = "str" ,
260+ description = "An arbitrary foo." ,
261+ example = "bar" ,
262+ ),
263+ ]
264+
265+ assert arg_sections [1 ].name == "object_list"
266+ assert arg_sections [1 ].entries == [
267+ Argument (
268+ path = "object_list.field_integer" ,
269+ required = True ,
270+ type = "int" ,
271+ description = "An arbitrary nested integer." ,
272+ example = "321" ,
273+ is_child = True ,
274+ depth = 1 ,
275+ parent = "object_list" ,
276+ ),
277+ Argument (
278+ path = "object_list.field_string" ,
279+ required = False ,
280+ type = "str" ,
281+ description = "An arbitrary nested string." ,
282+ example = "foobar" ,
283+ is_child = True ,
284+ depth = 1 ,
285+ parent = "object_list" ,
286+ ),
287+ ]
288+
186289 @staticmethod
187290 def _validate_resource_parameters (action : Action ):
188291 assert action .parameters == [
0 commit comments