FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects

Booked by list

Merged Robin Goodall requested to merge booked-by-list into master
Files
2
@@ -380,8 +380,7 @@ class BookerGetBookingsTests(TestCase):
# fixture has 3 bookings not made by 'essm-sync' user
self.assertEqual(len(s), 3)
for b in s:
if b.get('BookedBy') is not None and b['BookedBy'].get('Id') is not None:
self.assertNotEqual(b['BookedBy']['Id'], 'essm-sync')
self.assertNotEqual(b['BookedBy']['Id'], 'essm-sync')
def test_get_room_bookings_not_booked_by(self):
"""
@@ -399,8 +398,24 @@ class BookerGetBookingsTests(TestCase):
# fixture has 6 bookings not made by 'another-user' user
self.assertEqual(len(s), 6)
for b in s:
if b.get('BookedBy') is not None and b['BookedBy'].get('Id') is not None:
self.assertNotEqual(b['BookedBy']['Id'], 'another-user')
self.assertNotEqual(b['BookedBy']['Id'], 'another-user')
def test_get_room_bookings_not_booked_by_list(self):
"""
Booker get_room_bookings operation retrieves bookings not made by a list
of users
"""
self.assertIsNone(state.get('booker.roombookings'))
# Using list of booked by users
booked_by = ['real-user', 'essm-sync']
state.set('booker.booked_by', booked_by)
booker.op_get_room_bookings()
s = state.get('booker.roombookings')
self.assertIsInstance(s, list)
# fixture has no bookings not made by either 'real-user' or 'essm-sync'
self.assertEqual(len(s), 0)
def test_get_room_bookings_timeframe(self):
"""
@@ -487,8 +502,7 @@ class BookerGetBookingsTests(TestCase):
# fixture has 3 bookings made by 'essm-sync' user
self.assertEqual(len(s), 3)
for b in s:
if b.get('BookedBy') is not None and b['BookedBy'].get('Id') is not None:
self.assertEqual(b['BookedBy']['Id'], 'essm-sync')
self.assertEqual(b['BookedBy']['Id'], 'essm-sync')
def test_get_events_booked_by(self):
"""
@@ -505,8 +519,25 @@ class BookerGetBookingsTests(TestCase):
# fixture has 3 bookings made by 'real-user'
self.assertEqual(len(s), 3)
for b in s:
if b.get('BookedBy') is not None and b['BookedBy'].get('Id') is not None:
self.assertEqual(b['BookedBy']['Id'], 'real-user')
self.assertEqual(b['BookedBy']['Id'], 'real-user')
def test_get_events_booked_by_list(self):
"""
Booker get_events operation retrieves bookings made by a list of users
"""
self.assertIsNone(state.get('booker.events'))
# Using list of booked by users
booked_by = ['real-user', 'essm-sync']
state.set('booker.booked_by', booked_by)
booker.op_get_events()
s = state.get('booker.events')
self.assertIsInstance(s, list)
# fixture has 6 bookings made by either 'real-user' or 'essm-sync'
self.assertEqual(len(s), 6)
for b in s:
self.assertIn(b['BookedBy']['Id'], booked_by)
def test_get_events_timeframe(self):
"""
Loading