def _get_member_status(self, member_service_status): node_status = None for ns in member_service_status: if ns['service'] == 'NODE_STATUS': node_status = ns['status'] break return utils.get_member_status(node_status)
def _get_member_status(self, member_service_status): node_status = None for ns in member_service_status: if ns['service'] == 'NODE_STATUS': node_status = ns['status'] break return utils.get_member_status(node_status)
def test_get_member_status(self): self.assertEqual(const.MEMBER_STATUS_OFF, utils.get_member_status(None)) self.assertEqual(const.MEMBER_STATUS_OFF, utils.get_member_status('babo')) status = const.MEMBER_NODE_STATUS_FAILED self.assertEqual(const.MEMBER_STATUS_OFF, utils.get_member_status(status)) status = const.MEMBER_NODE_STATUS_INACTIVE self.assertEqual(const.MEMBER_STATUS_OFF, utils.get_member_status(status)) status = const.MEMBER_NODE_STATUS_WARNING self.assertEqual(const.MEMBER_STATUS_ON, utils.get_member_status(status)) status = const.MEMBER_NODE_STATUS_WORKING self.assertEqual(const.MEMBER_STATUS_ON, utils.get_member_status(status))