def test_reassign_all(self, mock_input):
        with no_stdout_or_stderr():
            call_command('hansard_reattribute_entries', **self.options)

        # Check that person_a has no entries and person_b has 3:
        self.assertEqual(0, Entry.objects.filter(speaker=self.person_a).count())
        self.assertEqual(3, Entry.objects.filter(speaker=self.person_b).count())
Esempio n. 2
0
    def test_reassign_all(self, mock_input):
        with no_stdout_or_stderr():
            call_command('hansard_reattribute_entries', **self.options)

        # Check that person_a has no entries and person_b has 3:
        self.assertEqual(0,
                         Entry.objects.filter(speaker=self.person_a).count())
        self.assertEqual(3,
                         Entry.objects.filter(speaker=self.person_b).count())
    def test_reassign_with_from_date(self, mock_input):
        options = self.options.copy()
        options['date_from'] = '2012-01-01'

        with no_stdout_or_stderr():
            call_command('hansard_reattribute_entries', **options)

        # Check that person_a has 1 entry and person_b has 2:
        self.assertEqual(1, Entry.objects.filter(speaker=self.person_a).count())
        self.assertEqual(2, Entry.objects.filter(speaker=self.person_b).count())
Esempio n. 4
0
    def test_reassign_with_from_date(self, mock_input):
        options = self.options.copy()
        options['date_from'] = '2012-01-01'

        with no_stdout_or_stderr():
            call_command('hansard_reattribute_entries', **options)

        # Check that person_a has 1 entry and person_b has 2:
        self.assertEqual(1,
                         Entry.objects.filter(speaker=self.person_a).count())
        self.assertEqual(2,
                         Entry.objects.filter(speaker=self.person_b).count())
    def test_reassign_all_with_slugs(self, mock_input):
        options = {
            'person_to': self.person_b.slug,
            'person_from': self.person_a.slug,
            'quiet': True
        }
        with no_stdout_or_stderr():
            call_command('hansard_reattribute_entries', **options)

        # Check that person_a has no entries and person_b has 3:
        self.assertEqual(0, Entry.objects.filter(speaker=self.person_a).count())
        self.assertEqual(3, Entry.objects.filter(speaker=self.person_b).count())
Esempio n. 6
0
    def test_reassign_all_with_slugs(self, mock_input):
        options = {
            'person_to': self.person_b.slug,
            'person_from': self.person_a.slug,
            'quiet': True
        }
        with no_stdout_or_stderr():
            call_command('hansard_reattribute_entries', **options)

        # Check that person_a has no entries and person_b has 3:
        self.assertEqual(0,
                         Entry.objects.filter(speaker=self.person_a).count())
        self.assertEqual(3,
                         Entry.objects.filter(speaker=self.person_b).count())