<commit_before>from datetime import date

from django.test import TestCase

from testapp.tests import factories

from zivinetz.models import AssignmentChange


class ChangesTestCase(TestCase):
    def test_change_tracking(self):
        assignment = factories.AssignmentFactory.create()

        self.assertEqual(AssignmentChange.objects.count(), 1)

        assignment.status = assignment.ARRANGED
        assignment.arranged_on = date.today()
        assignment.save()

        self.assertEqual(AssignmentChange.objects.count(), 2)

        assignment.status = assignment.MOBILIZED
        assignment.mobilized_on = date.today()
        assignment.save()

        self.assertEqual(AssignmentChange.objects.count(), 3)

        assignment.delete()

        self.assertEqual(AssignmentChange.objects.count(), 4)<commit_msg>Hit the list of assignment changes<commit_after>from datetime import date

from django.test import TestCase

from testapp.tests import factories

from zivinetz.models import AssignmentChange


class ChangesTestCase(TestCase):
    def test_change_tracking(self):
        assignment = factories.AssignmentFactory.create()

        self.assertEqual(AssignmentChange.objects.count(), 1)

        assignment.status = assignment.ARRANGED
        assignment.arranged_on = date.today()
        assignment.save()

        self.assertEqual(AssignmentChange.objects.count(), 2)

        assignment.status = assignment.MOBILIZED
        assignment.mobilized_on = date.today()
        assignment.save()

        self.assertEqual(AssignmentChange.objects.count(), 3)

        assignment.delete()

        self.assertEqual(AssignmentChange.objects.count(), 4)

        # Test the listing view.
        admin = factories.UserFactory.create(is_staff=True, is_superuser=True)
        self.client.login(username=admin.username, password='<PASSWORD>')

        self.assertContains(
            self.client.get('/zivinetz/reporting/assignmentchanges/'),
            'by unknown',
            4)
{'fraction_non_alphanumeric': 0.093687374749499, 'fraction_numerical': 0.0045090180360721445, 'mean_word_length': 3.2042105263157894, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1768599', 'n_tokens_mistral': 540, 'n_tokens_neox': 522, 'n_words': 100}