File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -349,6 +349,7 @@ def reboot(self):
349349 return True
350350
351351 def resize (self , new_type ):
352+ new_type = new_type .id if issubclass (type (new_type ), Base ) else new_type
352353 resp = self ._client .post ("{}/resize" .format (Instance .api_endpoint ), model = self , data = {"type" : new_type })
353354
354355 if 'error' in resp :
Original file line number Diff line number Diff line change @@ -172,6 +172,19 @@ def test_resize(self):
172172 self .assertEqual (m .call_url , '/linode/instances/123/resize' )
173173 self .assertEqual (m .call_data , {'type' : 'g6-standard-1' })
174174
175+ def test_resize_with_class (self ):
176+ """
177+ Tests that you can submit a correct resize api request with a Base class type
178+ """
179+ linode = Instance (self .client , 123 )
180+ ltype = Type (self .client , 'g6-standard-2' )
181+ result = {}
182+
183+ with self .mock_post (result ) as m :
184+ linode .resize (new_type = ltype )
185+ self .assertEqual (m .call_url , '/linode/instances/123/resize' )
186+ self .assertEqual (m .call_data , {'type' : 'g6-standard-2' })
187+
175188 def test_boot_with_config (self ):
176189 """
177190 Tests that you can submit a correct boot with a config api request
You can’t perform that action at this time.
0 commit comments