* adds workflow tests or deductions in InterventionWorkflowTestCase
* fixes bugs detected by testing
This commit is contained in:
2021-11-10 15:36:18 +01:00
parent d93ff4015b
commit 34fd78be5e
5 changed files with 198 additions and 18 deletions

View File

@@ -8,6 +8,7 @@ Created on: 26.10.21
from abc import abstractmethod
from django.contrib.auth.models import User, Group
from django.core.exceptions import ObjectDoesNotExist
from django.test import TestCase, Client
from django.urls import reverse
@@ -355,3 +356,22 @@ class BaseWorkflowTestCase(BaseTestCase):
cls.client_user = Client()
cls.client_user.login(username=cls.superuser.username, password=cls.superuser_pw)
cls.client_anon = Client()
def assert_object_is_deleted(self, obj):
""" Provides a quick check whether an object has been removed from the database or not
Args:
obj ():
Returns:
"""
# Expect the object to be gone from the db
try:
obj.refresh_from_db()
# Well, we should not reach this next line of code, since the object should be gone, therefore not
# refreshable -> fail!
self.fail()
except ObjectDoesNotExist:
# If we get in here, the test was fine
pass