@@ -36,8 +36,12 @@ def test_detail(self):
3636 'private_ip' : '10.0.1.2'
3737 }
3838 ],
39- 'hardware' : 'none' ,
40- 'usable ips' : 22
39+ 'hardware' : None ,
40+ 'usable ips' : 22 ,
41+ 'note' : 'test note' ,
42+ 'tags' : [
43+ 'subnet: test tag'
44+ ],
4145 },
4246 json .loads (result .output ))
4347
@@ -134,3 +138,35 @@ def test_create_subnet_static_ipv6(self, confirm_mock):
134138 ]
135139
136140 self .assertEqual (output , json .loads (result .output ))
141+
142+ @mock .patch ('SoftLayer.CLI.subnet.edit.click' )
143+ def test_subnet_set_tags (self , click ):
144+ result = self .run_command (['subnet' , 'edit' , '1234' , '--tags=tag1,tag2' ])
145+ click .secho .assert_called_with ('Set tags successfully' , fg = 'green' )
146+ self .assert_no_fail (result )
147+ self .assert_called_with ('SoftLayer_Network_Subnet' , 'setTags' , identifier = 1234 , args = ("tag1,tag2" ,))
148+
149+ @mock .patch ('SoftLayer.CLI.subnet.edit.click' )
150+ def test_subnet_edit_note (self , click ):
151+ result = self .run_command (['subnet' , 'edit' , '1234' , '--note=test' ])
152+ click .secho .assert_called_with ('Edit note successfully' , fg = 'green' )
153+ self .assert_no_fail (result )
154+ self .assert_called_with ('SoftLayer_Network_Subnet' , 'editNote' , identifier = 1234 , args = ("test" ,))
155+
156+ @mock .patch ('SoftLayer.CLI.subnet.edit.click' )
157+ def test_subnet_set_tags_failure (self , click ):
158+ mock = self .set_mock ('SoftLayer_Network_Subnet' , 'setTags' )
159+ mock .return_value = False
160+ result = self .run_command (['subnet' , 'edit' , '1234' , '--tags=tag1,tag2' ])
161+ click .secho .assert_called_with ('Failed to set tags' , fg = 'red' )
162+ self .assert_no_fail (result )
163+ self .assert_called_with ('SoftLayer_Network_Subnet' , 'setTags' , identifier = 1234 , args = ("tag1,tag2" ,))
164+
165+ @mock .patch ('SoftLayer.CLI.subnet.edit.click' )
166+ def test_edit_note_failure (self , click ):
167+ mock = self .set_mock ('SoftLayer_Network_Subnet' , 'editNote' )
168+ mock .return_value = False
169+ result = self .run_command (['subnet' , 'edit' , '1234' , '--note=test' ])
170+ click .secho .assert_called_with ('Failed to edit note' , fg = 'red' )
171+ self .assert_no_fail (result )
172+ self .assert_called_with ('SoftLayer_Network_Subnet' , 'editNote' , identifier = 1234 , args = ("test" ,))
0 commit comments