1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 19:26:48 +00:00
webvirtcloud/operations/tests/test_public_error.py
catborise 7d82cc7d6b fix(operations): a job refused by its checks in the worker says why
The worker's checks refuse with PermissionDenied or Http404, which carry
no text: the job failed with an empty error and its Logs row gave no
reason. They now read "You may no longer do this." and "The virtual
machine is no longer in the panel." (tr and zh too).
2026-11-05 16:28:29 +03:00

14 lines
652 B
Python

"""A job's checks in the worker refuse with Django's exceptions, which carry
no text: the job's error says why instead of being empty."""
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.test import SimpleTestCase
from operations.utils import public_error_text
class PublicErrorTests(SimpleTestCase):
def test_a_refusal_says_why(self):
self.assertEqual(public_error_text(PermissionDenied()), "You may no longer do this.")
self.assertEqual(public_error_text(Http404("No Instance matches the given query.")),
"The virtual machine is no longer in the panel.")