예제 #1
0
    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)
예제 #2
0
 def test_returns_unknown_for_unknown_fault(self):
     from supervisor import xmlrpc
     desc = xmlrpc.getFaultDescription(999999)
     self.assertEqual(desc, 'UNKNOWN')
예제 #3
0
 def test_returns_description_for_known_fault(self):
     from supervisor import xmlrpc
     desc = xmlrpc.getFaultDescription(xmlrpc.Faults.SHUTDOWN_STATE)
     self.assertEqual(desc, 'SHUTDOWN_STATE')