def test_one_free_robot(self): now = datetime(2000, 1, 1) + timedelta(minutes=5) all_robots = { 'n6': ['1', '2'], 'scribbler': ['asdad']} for model, ids in all_robots.items(): for id_ in ids: Reservation.reserve(self.user, model, id_, datetime(2000, 1, 1), datetime(2000, 1, 1) + timedelta(hours=1), self.session) all_robots['n6'].append('4') self.assertEquals(1, len(Reservation.available(all_robots, now=now, session=self.session)))
def test_reserve_occupied_robot_returns_none(self): reservation = Reservation.reserve(self.user, 'N6', '42', datetime(2000, 1, 1), datetime(2000, 1, 1) + timedelta(hours=1), self.session) self.assertIsNone(reservation)
def test_reserve_free_robot_returns_an_instance(self): reservation = Reservation.reserve(self.user, 'N6', '42', datetime(2000, 2, 1), datetime(2000, 2, 2), self.session) self.assertIsInstance(reservation, Reservation)
def test_one_free_robot(self): now = datetime(2000, 1, 1) + timedelta(minutes=5) all_robots = {'n6': ['1', '2'], 'scribbler': ['asdad']} for model, ids in all_robots.items(): for id_ in ids: Reservation.reserve(self.user, model, id_, datetime(2000, 1, 1), datetime(2000, 1, 1) + timedelta(hours=1), self.session) all_robots['n6'].append('4') self.assertEquals( 1, len( Reservation.available(all_robots, now=now, session=self.session)))
def test_reserve_occupied_robot_returns_none(self): reservation = Reservation.reserve( self.user, 'N6', '42', datetime(2000, 1, 1), datetime(2000, 1, 1) + timedelta(hours=1), self.session) self.assertIsNone(reservation)