Beispiel #1
0
 def test_enable_worker_raise_if_authenticated_but_not_admin(self):
     with self.assertRaises(PermissionDenied):
         client.enable_worker(
             _make_request(
                 is_authenticated=False,
                 is_superuser=False,
             ), 'worker')
Beispiel #2
0
    def test_enable_worker(self):
        w = Worker.objects.create(
            worker_key='disabled-worker',
            name='disabled-worker',
            enabled=False,
        )
        self.assertFalse(w.enabled)

        client.enable_worker(_make_request(), w.name)

        w = Worker.objects.get(id=w.id)
        self.assertTrue(w.enabled)
    def test_enable_worker(self):
        w = Worker.objects.create(
            worker_key='disabled-worker',
            name='disabled-worker',
            enabled=False,
        )
        self.assertFalse(w.enabled)

        client.enable_worker(_make_request(), w.name)

        w = Worker.objects.get(id=w.id)
        self.assertTrue(w.enabled)
 def test_enable_worker_raise_if_authenticated_but_not_admin(self):
     with self.assertRaises(PermissionDenied):
         client.enable_worker(_make_request(
             is_authenticated=False,
             is_superuser=False,
         ), 'worker')