def test_single_queue_name_for_zoom(self): from tilequeue.command import make_get_queue_name_for_zoom zoom_queue_map_cfg = {'0-20': 'q1'} queue_names = ['q1'] get_queue = make_get_queue_name_for_zoom( zoom_queue_map_cfg, queue_names) zoom = 7 queue_name = get_queue(zoom) self.assertEqual(queue_name, 'q1')
def test_zoom_out_of_range(self): from tilequeue.command import make_get_queue_name_for_zoom zoom_queue_map_cfg = {'0-5': 'q1'} queue_names = ['q1'] get_queue = make_get_queue_name_for_zoom( zoom_queue_map_cfg, queue_names) zoom = 7 with self.assertRaises(AssertionError): get_queue(zoom)
def test_zoom_invalid_lookup(self): from tilequeue.command import make_get_queue_name_for_zoom zoom_queue_map_cfg = {'0-20': 'q1'} queue_names = ['q1'] get_queue = make_get_queue_name_for_zoom( zoom_queue_map_cfg, queue_names) zoom = 21 with self.assertRaises(AssertionError): get_queue(zoom)
def test_zoom_is_long(self): # the zoom (or row/col) in a Coordinate can be a long simply because # the coordinate it was derived from in unmarshall_coord_int was a # long. from tilequeue.command import make_get_queue_name_for_zoom zoom_queue_map_cfg = {'0-20': 'q1'} queue_names = ['q1'] get_queue = make_get_queue_name_for_zoom( zoom_queue_map_cfg, queue_names) zoom = long(7) queue_name = get_queue(zoom) self.assertEqual(queue_name, 'q1')
def test_multiple_queues(self): from tilequeue.command import make_get_queue_name_for_zoom zoom_queue_map_cfg = {'0-5': 'q1', '6-20': 'q2'} queue_names = ['q1', 'q2'] get_queue = make_get_queue_name_for_zoom( zoom_queue_map_cfg, queue_names) zoom = 5 queue_name = get_queue(zoom) self.assertEqual(queue_name, 'q1') zoom = 15 queue_name = get_queue(zoom) self.assertEqual(queue_name, 'q2')
def test_missing_queue_name(self): from tilequeue.command import make_get_queue_name_for_zoom zoom_queue_map_cfg = {'0-5': 'q1', '6-20': 'q3'} queue_names = ['q1', 'q2'] with self.assertRaises(AssertionError): make_get_queue_name_for_zoom(zoom_queue_map_cfg, queue_names)
def test_bad_map(self): from tilequeue.command import make_get_queue_name_for_zoom zoom_queue_map_cfg = {'badzoom-20': 'q1'} queue_names = ['q1'] with self.assertRaises(AssertionError): make_get_queue_name_for_zoom(zoom_queue_map_cfg, queue_names)