def test_disable_worker_raise_if_authenticated_but_not_admin(self): with self.assertRaises(PermissionDenied): client.disable_worker( _make_request( is_authenticated=False, is_superuser=False, ), 'worker')
def test_disable_worker(self): w = Worker.objects.create( worker_key='enabled-worker', name='enabled-worker', enabled=True, ) self.assertTrue(w.enabled) client.disable_worker(_make_request(), w.name) w = Worker.objects.get(id=w.id) self.assertFalse(w.enabled)
def test_disable_worker_raise_if_authenticated_but_not_admin(self): with self.assertRaises(PermissionDenied): client.disable_worker(_make_request( is_authenticated=False, is_superuser=False, ), 'worker')