Esempio n. 1
0
 def create_factories(self):
     # We want a user who lives somewhere with a membership!
     super().create_factories()
     self.user = UserWithHostFactory.create(
         with_membership=True,
         membership__group=self.config.member_group,
     )
Esempio n. 2
0
    def create_factories(self):
        self.user = UserWithHostFactory.create()
        self.network_access_group = PropertyGroupFactory.create(
            name="Member",
            granted={'network_access'},
        )
        self.payment_in_default_group = PropertyGroupFactory.create(
            name="Blocked (finance)",
            granted={'payment_in_default'},
            denied={'network_access'},
        )
        self.traffic_limit_exceeded_group = PropertyGroupFactory.create(
            name="Blocked (traffic)",
            granted={'traffic_limit_exceeded'},
            denied={'network_access'},
        )

        # the user's room needs to be connected to provide `nasipaddress` and `nasportid`
        self.switch = SwitchFactory.create(host__owner=self.user)
        PatchPortFactory.create_batch(2, patched=True, switch_port__switch=self.switch,
                                      # This needs to be the HOSTS room!
                                      room=self.user.hosts[0].room)

        MembershipFactory.create(user=self.user, group=self.network_access_group,
                                 begins_at=datetime.now() + timedelta(-1),
                                 ends_at=datetime.now() + timedelta(1))

        session.session.execute(hades.radius_property.insert(values=[
            ('payment_in_default',),
            ('traffic_limit_exceeded',),
        ]))
Esempio n. 3
0
 def create_factories(self):
     # We want a user who lives somewhere with a membership!
     super().create_factories()
     self.processor = UserFactory.create()
     self.user = UserWithHostFactory.create()
     self.membership = MembershipFactory.create(user=self.user,
                                                group=self.config.member_group)
     self.other_room = RoomFactory.create()
Esempio n. 4
0
    def create_factories(self):
        self.user = UserWithHostFactory.create()
        self.network_access_group = PropertyGroupFactory.create(
            name="Member",
            granted={'network_access'},
        )
        self.payment_in_default_group = PropertyGroupFactory.create(
            name="Blocked (finance)",
            granted={'payment_in_default'},
            denied={'network_access'},
        )
        self.traffic_limit_exceeded_group = PropertyGroupFactory.create(
            name="Blocked (traffic)",
            granted={'traffic_limit_exceeded'},
            denied={'network_access'},
        )

        # the user's room needs to be connected to provide `nasipaddress` and `nasportid`
        self.switch = SwitchFactory.create(host__owner=self.user)
        PatchPortFactory.create_batch(
            2,
            patched=True,
            switch_port__switch=self.switch,
            # This needs to be the HOSTS room!
            room=self.user.hosts[0].room)

        MembershipFactory.create(user=self.user,
                                 group=self.network_access_group,
                                 begins_at=datetime.now() + timedelta(-1),
                                 ends_at=datetime.now() + timedelta(1))

        session.session.execute(
            hades.radius_property.insert(values=[
                ('payment_in_default', ),
                ('traffic_limit_exceeded', ),
            ]))
Esempio n. 5
0
 def create_factories(self):
     super().create_factories()
     self.user = UserWithHostFactory.create()
     MembershipFactory.create(user=self.user,
                              group=self.config.member_group)
     self.test_user_id = self.user.id
Esempio n. 6
0
 def create_factories(self):
     super().create_factories()
     self.interface = InterfaceFactory.create()
     UserWithHostFactory.create(host__interface=self.interface)
     self.processor = UserFactory.create()