Commit e421bc91 authored by Michal Čihař's avatar Michal Čihař

Add test for offloaded index update on unit deletion

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 0b9cd9d6
......@@ -36,6 +36,7 @@ from django.core.exceptions import ValidationError
from weblate.trans.models import (
Project, SubProject, Source, Unit, WhiteboardMessage, Check, Suggestion,
IndexUpdate,
get_related_units,
)
from weblate import appsettings
......@@ -446,6 +447,24 @@ class SubProjectTest(RepoTestCase):
self.assertTrue(os.path.exists(project.get_path()))
project.delete()
self.assertFalse(os.path.exists(project.get_path()))
self.assertEqual(0, SubProject.objects.count())
@OverrideSettings(OFFLOAD_INDEXING=False)
def test_delete_no_offload(self):
project = self.create_subproject()
project.delete()
self.assertEqual(0, IndexUpdate.objects.count())
@OverrideSettings(OFFLOAD_INDEXING=True)
def test_delete_offload(self):
project = self.create_subproject()
project.delete()
self.assertEqual(
12, IndexUpdate.objects.count()
)
self.assertEqual(
12, IndexUpdate.objects.filter(to_delete=True).count()
)
def test_delete_link(self):
project = self.create_link()
......@@ -857,7 +876,6 @@ class SubProjectTest(RepoTestCase):
# Check suggestion has been copied
self.assertEqual(subproject.project.suggestion_set.count(), 1)
class TranslationTest(RepoTestCase):
"""
Translation testing.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment