Esempio n. 1
0
    def test_condb_137_intra_labour(self):
        """
        If the personnel class of the worker changes, the badge shall be revoked and a new one issued.
        """

        signup, unused = Signup.get_or_create_dummy(accepted=True)
        pc1 = signup.personnel_classes.get()

        badge, created = Badge.ensure(person=self.person, event=self.event)
        assert not created
        assert badge.personnel_class == pc1

        # Create another personnel class that is guaranteed to be higher in priority than the current one.
        pc2, unused = PersonnelClass.get_or_create_dummy(
            name='Sehr Wichtig Fellow',
            priority=pc1.priority - 10
        )

        self.event.labour_event_meta.create_groups()

        signup.personnel_classes.add(pc2)
        signup.apply_state()

        badge, created = Badge.ensure(person=self.person, event=self.event)
        assert not created
        assert badge.personnel_class == pc2
Esempio n. 2
0
    def get_or_create_dummy(cls):
        person, unused = Person.get_or_create_dummy()
        personnel_class, unused = PersonnelClass.get_or_create_dummy()

        return cls.objects.get_or_create(
            person=person,
            personnel_class=personnel_class,
        )
Esempio n. 3
0
    def get_or_create_dummy(cls):
        from core.models import Person
        from labour.models import PersonnelClass

        person, unused = Person.get_or_create_dummy()
        personnel_class, unused = PersonnelClass.get_or_create_dummy()

        return cls.objects.get_or_create(
            person=person,
            personnel_class=personnel_class,
        )
Esempio n. 4
0
    def get_or_create_dummy(cls):
        from core.models import Person
        from labour.models import PersonnelClass

        person, unused = Person.get_or_create_dummy()
        personnel_class, unused = PersonnelClass.get_or_create_dummy()

        return cls.objects.get_or_create(
            person=person,
            personnel_class=personnel_class,
        )
Esempio n. 5
0
    def get_or_create_dummy(cls, personnel_class=None, priority=0, title='Overbaron'):
        from labour.models import PersonnelClass

        if personnel_class is None:
            personnel_class, unused = PersonnelClass.get_or_create_dummy(
                app_label='programme',
                name='Entertainer',
                priority=40,
            )

        return cls.objects.get_or_create(
            personnel_class=personnel_class,
            title=title,
            defaults=dict(
                priority=priority,
                require_contact_info=False,
            )
        )
Esempio n. 6
0
    def test_condb_137_intra_labour(self):
        """
        If the personnel class of the worker changes, the badge shall be revoked and a new one issued.
        """

        signup, unused = Signup.get_or_create_dummy(accepted=True)
        pc1 = signup.personnel_classes.get()

        badge, created = Badge.ensure(person=self.person, event=self.event)
        assert not created
        assert badge.personnel_class == pc1

        # Create another personnel class that is guaranteed to be higher in priority than the current one.
        pc2, unused = PersonnelClass.get_or_create_dummy(
            name='Sehr Wichtig Fellow', priority=pc1.priority - 10)

        self.event.labour_event_meta.create_groups()

        signup.personnel_classes.add(pc2)
        signup.apply_state()

        badge, created = Badge.ensure(person=self.person, event=self.event)
        assert not created
        assert badge.personnel_class == pc2