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')
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)
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')
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')
def test_get_worker_info_non_existent(self): info = client.get_worker_info(_make_request(), 'non-existent') self.assertEqual(info, {})
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')