Example #1
0
    def test_set_identifier_allready_set(self):
        """
        If the motion already has a identifier, the method does nothing.
        """
        motion = Motion(identifier='My test identifier')

        motion.set_identifier()

        self.assertEqual(motion.identifier, 'My test identifier')
Example #2
0
    def test_set_identifier_manually(self):
        """
        If the config is set to manually, the method does nothing.
        """
        config['motion_identifier'] = 'manually'
        motion = Motion()

        motion.set_identifier()

        # If the identifier should be set manually, the method does nothing
        self.assertIsNone(motion.identifier)
Example #3
0
    def test_set_identifier_amendment(self):
        """
        If the motion is an amendment, the identifier is the identifier from the
        parent + a suffix.
        """
        config['motion_amendments_enabled'] = True
        self.motion.identifier = 'Parent identifier'
        self.motion.save()
        motion = Motion(parent=self.motion)

        motion.set_identifier()

        self.assertEqual(motion.identifier, 'Parent identifier A 1')
Example #4
0
    def test_set_identifier_second_amendment(self):
        """
        If a motion has already an amendment, the second motion gets another
        identifier.
        """
        config['motion_amendments_enabled'] = True
        self.motion.identifier = 'Parent identifier'
        self.motion.save()
        Motion.objects.create(title='Amendment1', parent=self.motion)
        motion = Motion(parent=self.motion)

        motion.set_identifier()

        self.assertEqual(motion.identifier, 'Parent identifier A 2')