def test_canonicalize_queue_confusion(self): """Test that find_queue will bail in case of confusion""" common.canonicalize_queue('ajax').AndReturn('ajax') common.get_hesiod_print_server('ajax').AndReturn(None) self.mox.ReplayAll() self.assertEqual(common.find_queue('ajax'), (common.SYSTEM_CUPS, None, 'ajax'))
def test_queue_with_instance(self): """Verify that find_queue will strip instances""" common.canonicalize_queue('ajax/2sided').AndReturn('ajax/2sided') common.get_hesiod_print_server('ajax').AndReturn('GET-PRINT.MIT.EDU') # We no longer call "is_cups_server" # common.is_cups_server('GET-PRINT.MIT.EDU').AndReturn(True) self.mox.ReplayAll() self.assertEqual(common.find_queue('ajax/2sided'), (common.SYSTEM_CUPS, 'GET-PRINT.MIT.EDU', 'ajax'))
def test_athena_cups_queue(self): """Verify that find_queue can find non-local Athena queues on CUPS""" common.canonicalize_queue('ajax').AndReturn('ajax') common.get_hesiod_print_server('ajax').AndReturn('GET-PRINT.MIT.EDU') # We no longer call "is_cups_server" # common.is_cups_server('GET-PRINT.MIT.EDU').AndReturn(True) self.mox.ReplayAll() self.assertEqual(common.find_queue('ajax'), (common.SYSTEM_CUPS, 'GET-PRINT.MIT.EDU', 'ajax'))
def test_misnamed_local_queue(self): """Verify that find_queue will use canonicalized queue names""" common.canonicalize_queue('w20').AndReturn('ajax') common.get_hesiod_print_server('ajax').AndReturn('GET-PRINT.MIT.EDU') # We no longer call "is_cups_server" # common.is_cups_server('GET-PRINT.MIT.EDU').AndReturn(True) self.mox.ReplayAll() self.assertEqual(common.find_queue('w20'), (common.SYSTEM_CUPS, 'GET-PRINT.MIT.EDU', 'ajax'))
def test_parse_pcap(self): """Test get_hesiod_print_server's ability to parse pcap records""" self.mox.StubOutWithMock(common, '_hesiod_lookup') common._hesiod_lookup('ajax', 'pcap').AndReturn( ['ajax:rp=ajax:rm=GET-PRINT.MIT.EDU:ka#0:mc#0:']) self.mox.ReplayAll() self.assertEqual(common.get_hesiod_print_server('ajax'), 'GET-PRINT.MIT.EDU')