@@ -151,13 +151,11 @@ def test_command_inline(self):
151151 url = reverse (
152152 f"admin:{ self .config_app_label } _device_change" , args = (self .device .id ,)
153153 )
154-
155154 with self .subTest (
156155 'Test "Recent Commands" not shown for a device without commands'
157156 ):
158157 response = self .client .get (url )
159158 self .assertNotContains (response , "Recent Commands" )
160-
161159 with self .subTest ('Test "Recent Commands" shown for a device having commands' ):
162160 self ._create_custom_command ()
163161 response = self .client .get (url )
@@ -184,15 +182,13 @@ def test_command_status_highlighting(self):
184182 device = self .device ,
185183 status = "success" ,
186184 )
187-
188185 with self .subTest ("Test success status" ):
189186 response = self .client .get (url )
190187 self .assertContains (
191188 response ,
192189 '<span class="command-status success">success</span>' ,
193190 html = True ,
194191 )
195-
196192 with self .subTest ("Test failed status" ):
197193 command .status = "failed"
198194 command .save ()
@@ -202,7 +198,6 @@ def test_command_status_highlighting(self):
202198 '<span class="command-status failed">failed</span>' ,
203199 html = True ,
204200 )
205-
206201 with self .subTest ("Test in-progress status" ):
207202 command .status = "in-progress"
208203 command .save ()
@@ -217,13 +212,11 @@ def test_command_writable_inline(self):
217212 url = reverse (
218213 f"admin:{ self .config_app_label } _device_change" , args = (self .device .id ,)
219214 )
220-
221215 with self .subTest (
222216 "Test add command form is present for a device without commands"
223217 ):
224218 response = self .client .get (url )
225219 self .assertContains (response , "id_command_set" )
226-
227220 with self .subTest (
228221 "Test add command form is present for a device having commands"
229222 ):
@@ -264,19 +257,16 @@ def test_commands_schema_view(self):
264257 self .assertIn ("custom" , result )
265258 self .assertIn ("change_password" , result )
266259 self .assertIn ("reboot" , result )
267-
268260 with self .subTest ("Test superuser request with organization_id" ):
269261 response = self .client .get (url )
270262 self .assertEqual (response .status_code , 200 )
271263 result = json .loads (response .content )
272264 self .assertIn ("reboot" , result )
273-
274265 self .client .logout ()
275266 self .client .force_login (org_admin )
276267 with self .subTest ("Test org admin request without organization_id" ):
277268 response = self .client .get (url )
278269 self .assertEqual (response .status_code , 403 )
279-
280270 with self .subTest ("Test org admin request with organization_id" ):
281271 response = self .client .get (url , {"organization_id" : str (org .id )})
282272 self .assertEqual (response .status_code , 200 )
0 commit comments