Source code for uw.local.teaching.webui.room_render_test
import unittest
from collections import namedtuple
from uw.local.teaching.webui.room_render import *
[docs]class RoomRenderTests (unittest.TestCase):
[docs] def setUp (self):
""" Setup method which runs before each test case.
"""
pass
[docs] def test_dict_from_seats (self):
""" Tests dict_from_seats ()
"""
Seat = namedtuple ('Seat', 'seat_col seat_row')
seats = iter ([
Seat (seat_col='1', seat_row='1'),
Seat (seat_col='2', seat_row='2'),
])
seats_dict = {
('1', '1'): Seat (seat_col='1', seat_row='1'),
('2', '2'): Seat (seat_col='2', seat_row='2'),
}
self.assertEqual (seats_dict, dict_from_seats (seats))
[docs] def test_render_loading_standard_text_no_input (self):
""" Tests render_loading_standard_text without any parameters so they
default to False.
"""
text = 'The capacity shown is based on your settings: avoiding tablet-arm seats and, where needed, skipping every other seat.'
self.assertEqual (text, render_loading_standard_text ())
[docs] def test_render_loading_standard_text_single_input (self):
""" Tests render_loading_standard_text with allow_tablet_seats set to
True.
"""
text = 'The capacity shown is based on your settings: using tablet-arm seats and, where needed, skipping every other seat.'
self.assertEqual (text, render_loading_standard_text (True))
[docs] def test_render_loading_standard_text_both_inputs (self):
""" Tests render_loading_standard_text with both inputs set to True.
"""
text = 'The capacity shown is based on your settings: using tablet-arm seats and not skipping every other seat.'
self.assertEqual (text, render_loading_standard_text (True, True))