Пример #1
0
 def create_factories(self):
     super().create_factories()
     # we just create the subnet to ensure it stays the same when in the same building
     subnet = factories.SubnetFactory()
     self.user = UserWithHostFactory(
         room__patched_with_subnet=True,
         room__patch_ports__switch_port__default_vlans__subnets=[subnet])
     self.processing_user = UserFactory()
     self.old_room = self.user.room
     assert all(h.room == self.old_room for h in self.user.hosts)
     self.new_room_other_building = factories.RoomFactory(
         patched_with_subnet=True)
     self.new_room_same_building = factories.RoomFactory(
         building=self.old_room.building,
         patched_with_subnet=True,
         patch_ports__switch_port__default_vlans__subnets=[subnet],
     )
Пример #2
0
    def create_factories(self):
        super().create_factories()
        address = factories.AddressFactory()
        self.room = factories.RoomFactory(address=address)

        self.hans = factories.UserFactory(room=self.room,
                                          name="Hans",
                                          address=address)
        self.franz = factories.UserFactory(room=self.room,
                                           name="Franz",
                                           address=factories.AddressFactory())
Пример #3
0
 def create_factories(self):
     super().create_factories()
     self.room = factories.RoomFactory(level=1,
                                       number="1",
                                       patched_with_subnet=True)
     self.processing_user = UserFactory()
     self.user = UserFactory(with_membership=True,
                             membership__group=self.config.member_group,
                             room=None,
                             address=self.room.address,
                             birthdate=datetime.fromisoformat('2000-01-01'))
     self.mac = '00:de:ad:be:ef:00'
Пример #4
0
    def create_factories(self):
        super().create_factories()
        # We need a user in the same room
        self.room = factories.RoomFactory()
        self.similar_user_this_room = factories.UserFactory(room=self.room, name="Tobias Fuenke")

        self.similar_user_room_history = factories.UserFactory(name="Tobias")
        self.session.add(RoomHistoryEntry(room=self.room, user=self.similar_user_room_history))

        # nonsimilar users (same room / room history)
        factories.UserFactory(room=self.room, name="Other dude")
        self.session.add(RoomHistoryEntry(room=self.room,
                                          user=factories.UserFactory(name="Other dude")))
Пример #5
0
    def create_factories(self):
        super().create_factories()
        utcnow = self.session.query(func.current_timestamp()).scalar()
        interval = closedopen(utcnow, None)
        # We need a user in the same room
        self.room = factories.RoomFactory()
        self.similar_user_this_room = factories.UserFactory(room=self.room, name="Tobias Fuenke")

        self.similar_user_room_history = factories.UserFactory(name="Tobias")
        self.session.add(RoomHistoryEntry(room=self.room, user=self.similar_user_room_history,
                                          active_during=interval))

        # nonsimilar users (same room / room history)
        factories.UserFactory(room=self.room, name="Other dude")
        self.session.add(RoomHistoryEntry(room=self.room,
                                          user=factories.UserFactory(name="Other dude"),
                                          active_during=interval))
Пример #6
0
def room(module_session):
    return factories.RoomFactory()
Пример #7
0
 def create_factories(self):
     super().create_factories()
     self.config = factories.ConfigFactory()
     self.room = factories.RoomFactory(level=1, number="1", patched_with_subnet=True)
     self.processing_user = UserFactory()
Пример #8
0
 def create_factories(self):
     super().create_factories()
     self.room = factories.RoomFactory()
     self.user = factories.UserFactory()
Пример #9
0
 def create_factories(self):
     super().create_factories()
     self.room = factories.RoomFactory()
     factories.UserFactory.create_batch(3, room=self.room)
     self.processor = factories.UserWithoutRoomFactory()