Ejemplo n.º 1
0
 def test_get_worker_info_raise_if_authenticated_but_not_admin(self):
     with self.assertRaises(PermissionDenied):
         client.get_worker_info(
             _make_request(
                 is_authenticated=False,
                 is_superuser=False,
             ), 'worker')
Ejemplo n.º 2
0
    def test_get_worker_info(self):
        w = Worker.objects.create(
            worker_key='test-worker',
            name='test-worker',
        )

        info = client.get_worker_info(_make_request(), w.name)
        self.assertEqual(info['id'], w.id)
Ejemplo n.º 3
0
    def test_get_worker_info(self):
        w = Worker.objects.create(
            worker_key='test-worker',
            name='test-worker',
        )

        info = client.get_worker_info(_make_request(), w.name)
        self.assertEqual(info['id'], w.id)
Ejemplo n.º 4
0
 def test_get_worker_info_if_authenticated_but_not_admin(self):
     # Should be permissible if authenticated, but not admin - no exception raised
     client.get_worker_info(_make_request(
         is_authenticated=False,
         is_superuser=False,
     ), 'worker')
Ejemplo n.º 5
0
 def test_get_worker_info_no_auth(self):
     # Should be permissible if anonymous - no exception raised
     client.get_worker_info(_make_request(
         is_authenticated=False,
         is_superuser=False,
     ), 'worker')
Ejemplo n.º 6
0
 def test_get_worker_info_non_existent(self):
     info = client.get_worker_info(_make_request(), 'non-existent')
     self.assertEqual(info, {})
Ejemplo n.º 7
0
 def test_get_worker_info_raise_if_authenticated_but_not_admin(self):
     with self.assertRaises(PermissionDenied):
         client.get_worker_info(_make_request(
             is_authenticated=False,
             is_superuser=False,
         ), 'worker')
Ejemplo n.º 8
0
 def test_get_worker_info_non_existent(self):
     info = client.get_worker_info(_make_request(), 'non-existent')
     self.assertEqual(info, {})