Esempio n. 1
0
 def test_cleanup_old_comments(self, expected=2):
     unit = self.get_unit()
     Comment.objects.add(unit.source_info, self.user, 'Zkouška')
     Comment.objects.all().update(timestamp=timezone.now() -
                                  timedelta(days=30))
     Comment.objects.add(unit.source_info, self.user, 'Zkouška 2')
     cleanup_old_comments()
     self.assertEqual(Comment.objects.count(), expected)
Esempio n. 2
0
 def test_cleanup_old_comments(self, expected=2):
     request = self.get_request()
     unit = self.get_unit()
     Comment.objects.add(unit.source_unit, request, "Zkouška")
     Comment.objects.all().update(timestamp=timezone.now() -
                                  timedelta(days=30))
     Comment.objects.add(unit.source_unit, request, "Zkouška 2")
     cleanup_old_comments()
     self.assertEqual(Comment.objects.count(), expected)
Esempio n. 3
0
 def handle(self, *args, **options):
     """Perfom cleanup of Weblate database."""
     cleanup_screenshot_files()
     with transaction.atomic():
         cleanup_social_auth()
     for project in Project.objects.values_list("id", flat=True):
         cleanup_project(project)
     cleanup_suggestions()
     cleanup_stale_repos()
     cleanup_old_suggestions()
     cleanup_old_comments()
Esempio n. 4
0
 def handle(self, *args, **options):
     """Perfom cleanup of Weblate database."""
     cleanup_fulltext()
     cleanup_screenshot_files()
     with transaction.atomic():
         cleanup_social_auth()
     for project in Project.objects.values_list('id', flat=True):
         cleanup_project(project)
     cleanup_suggestions()
     cleanup_stale_repos()
     cleanup_old_suggestions()
     cleanup_old_comments()