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_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 #3
0
    def test_set_identifier_manually(self):
        """
        If the config is set to manually, the method does nothing.
        """
        config["motions_identifier"] = "manually"
        motion = Motion()

        motion.set_identifier()

        # If the identifier should be set manually, the method does nothing
        self.assertIsNone(motion.identifier)
Example #4
0
    def test_set_identifier_manually(self):
        """
        If the config is set to manually, the method does nothing.
        """
        config['motions_identifier'] = 'manually'
        motion = Motion()

        motion.set_identifier()

        # If the identifier should be set manually, the method does nothing
        self.assertIsNone(motion.identifier)
Example #5
0
    def test_set_identifier_manually(self):
        """
        If the config is set to manually, the method does nothing.
        """
        config['motions_identifier'] = 'manually'
        get_redis_connection("default").flushall()
        motion = Motion()

        motion.set_identifier()

        # If the identifier should be set manually, the method does nothing
        self.assertIsNone(motion.identifier)
Example #6
0
    def test_set_identifier_amendment(self):
        """
        If the motion is an amendment, the identifier is the identifier from the
        parent + a suffix.
        """
        config["motions_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 #7
0
    def test_set_identifier_amendment(self):
        """
        If the motion is an amendment, the identifier is the identifier from the
        parent + a suffix.
        """
        config['motions_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 #8
0
    def test_set_identifier_second_amendment(self):
        """
        If a motion has already an amendment, the second motion gets another
        identifier.
        """
        config["motions_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")
Example #9
0
    def test_set_identifier_second_amendment(self):
        """
        If a motion has already an amendment, the second motion gets another
        identifier.
        """
        config['motions_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')
Example #10
0
    def test_set_identifier_second_amendment(self):
        """
        If a motion has already an amendment, the second motion gets another
        identifier.
        """
        config['motions_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 - 2')
Example #11
0
    def test_set_identifier_second_amendment(self):
        """
        If a motion has already an amendment, the second motion gets another
        identifier.
        """
        config["motions_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 - 2")
Example #12
0
    def test_set_identifier_amendment(self):
        """
        If the motion is an amendment, the identifier is the identifier from the
        parent + a suffix.
        """
        config["motions_amendments_enabled"] = True
        config["motions_identifier_with_blank"] = False
        self.motion.identifier = "Parent identifier"
        self.motion.save()
        motion = Motion(parent=self.motion)

        motion.set_identifier()

        self.assertEqual(motion.identifier, "Parent identifier-1")
Example #13
0
    def test_set_identifier_amendment(self):
        """
        If the motion is an amendment, the identifier is the identifier from the
        parent + a suffix.
        """
        config['motions_amendments_enabled'] = True
        self.motion.identifier = 'Parent identifier'
        self.motion.save()
        get_redis_connection("default").flushall()
        motion = Motion(parent=self.motion)

        motion.set_identifier()

        self.assertEqual(motion.identifier, 'Parent identifier - 1')