def test_handle_rpc_fault_handles_all_faults(self): rpc_helper = RPCHelper() supervisor_fault_codes = self.attrDictWithoutUnders( SupervisorFaults).values() for item in supervisor_fault_codes: fault = Fault(item, getFaultDescription(item)) if item == 2 or item == 10: with self.assertRaises(SystemExit): rpc_helper.handle_rpc_fault(fault) else: with self.assertRaises(Fault): rpc_helper.handle_rpc_fault(fault)
def test_returns_unknown_for_unknown_fault(self): from supervisor import xmlrpc desc = xmlrpc.getFaultDescription(999999) self.assertEqual(desc, 'UNKNOWN')
def test_returns_description_for_known_fault(self): from supervisor import xmlrpc desc = xmlrpc.getFaultDescription(xmlrpc.Faults.SHUTDOWN_STATE) self.assertEqual(desc, 'SHUTDOWN_STATE')