当前位置: 首页>>代码示例>>Python>>正文


Python testutils.get_priv_attr函数代码示例

本文整理汇总了Python中testutils.get_priv_attr函数的典型用法代码示例。如果您正苦于以下问题:Python get_priv_attr函数的具体用法?Python get_priv_attr怎么用?Python get_priv_attr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_priv_attr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_ensure_connection

 def test_ensure_connection(self):
     options = {}
     comm = CommonForTest(options)
     comm.ensure_connection()
     nova_ep = testutils.get_priv_attr(comm, "__nova_ep", "Common")
     self.assertEqual(nova_ep, comm.NOVA_EP)
     ceilometer_ep = \
         testutils.get_priv_attr(comm, "__ceilometer_ep", "Common")
     self.assertEqual(ceilometer_ep, comm.CEILOMETER_EP)
开发者ID:nanuyokakinu,项目名称:hatohol,代码行数:9,代码来源:TestHap2Ceilometer.py

示例2: test_dispatch_receive_id_notification

 def test_dispatch_receive_id_notification(self):
     destination_queue = DummyQueue()
     test_id = "test"
     test_contents = 1
     test_message = (test_id, test_contents)
     dispatch_queue = testutils.get_priv_attr(self.__dispatcher, "__dispatch_queue")
     dispatch_queue.put(test_message)
     self.__dispatcher.attach_destination(destination_queue, test_id)
     dispatch = testutils.get_priv_attr(self.__dispatcher, "__dispatch")
     testutils.assertNotRaises(dispatch)
开发者ID:AokiTakumi,项目名称:hatohol,代码行数:10,代码来源:TestHaplib.py

示例3: test_log_status

 def test_log_status(self):
     poller = haplib.BasePoller(sender=self.sender, process_id="test")
     log_time = testutils.get_priv_attr(poller, "__next_log_status_time")
     poller.log_status(haplib.ArmInfo())
     # check if the next time is update
     new_time = testutils.get_priv_attr(poller, "__next_log_status_time")
     self.assertGreater(new_time, log_time)
     # call again soon. __new_log_status_time should not be updated.
     new_time2 = testutils.get_priv_attr(poller, "__next_log_status_time")
     self.assertEquals(new_time2, new_time)
开发者ID:AokiTakumi,项目名称:hatohol,代码行数:10,代码来源:TestHaplib.py

示例4: test_detect_implemented_procedures

 def test_detect_implemented_procedures(self):
     detect_implemented_procedures = testutils.get_priv_attr(self.__main_plugin, "__detect_implemented_procedures")
     detect_implemented_procedures()
     implemented_procedures = testutils.get_priv_attr(self.__main_plugin, "__implemented_procedures")
     self.assertEquals(
         {
             "exchangeProfile": self.__main_plugin.hap_exchange_profile,
             "updateMonitoringServerInfo": self.__main_plugin.hap_update_monitoring_server_info,
         },
         implemented_procedures,
     )
开发者ID:AokiTakumi,项目名称:hatohol,代码行数:11,代码来源:TestHaplib.py

示例5: test_reset

 def test_reset(self):
     self.processor.reset()
     prev_hosts = testutils.get_priv_attr(self.processor, "__previous_hosts")
     prev_host_groups = testutils.get_priv_attr(self.processor,
                                                "__previous_host_groups")
     prev_host_group_membership = \
             testutils.get_priv_attr(self.processor,
                                     "__previous_host_group_membership")
     event_last_info = testutils.get_priv_attr(self.processor,
                                               "__event_last_info")
     self.assertIsNone(prev_hosts)
     self.assertIsNone(prev_host_groups)
     self.assertIsNone(prev_host_group_membership)
     self.assertIsNone(event_last_info)
开发者ID:nanuyokakinu,项目名称:hatohol,代码行数:14,代码来源:TestHaplib.py

示例6: test__collect_events_and_put

 def test__collect_events_and_put(self):
     comm = CommonForTest()
     comm.ensure_connection()
     target_func = testutils.get_priv_attr(comm, "__collect_events_and_put",
                                           "Common")
     # TODO: test the path when alarm_cache is hit
     #       In that case, hostId, hostName, and brief should not be "N/A"
     alarm_id = "alarm1"
     last_alarm_time = "20150423112233.123000"
     fetch_id = "a123"
     target_func(alarm_id, last_alarm_time, fetch_id)
     self.assertEquals(comm.store["fetch_id"], fetch_id)
     self.assertEquals(comm.store["last_info_generator"],
         testutils.get_priv_attr(comm, "__last_info_generator", "Common"))
     self.assertEquals(comm.store["events"], [
         {
             "eventId": "event_id_0",
             "time": "20130322045000.334455",
             "type": "GOOD",
             "status": "OK",
             "triggerId": alarm_id,
             "hostId": "N/A",
             "hostName": "N/A",
             "severity": "ERROR",
             "brief": "N/A",
             "extendedInfo": "",
         }, {
             "eventId": "event_id_1",
             "time": "20130322045600.334455",
             "status": "OK",
             "type": "GOOD",
             "triggerId": alarm_id,
             "hostId": "N/A",
             "hostName": "N/A",
             "severity": "ERROR",
             "brief": "N/A",
             "extendedInfo": "",
         }, {
             "eventId": "event_id_2",
             "time": "20130322045612.111222",
             "type": "BAD",
             "status": "NG",
             "triggerId": alarm_id,
             "hostId": "N/A",
             "hostName": "N/A",
             "severity": "ERROR",
             "brief": "N/A",
             "extendedInfo": "",
         }])
开发者ID:nanuyokakinu,项目名称:hatohol,代码行数:49,代码来源:TestHap2Ceilometer.py

示例7: test_encode_decode_last_alarm_timestamp_map

 def test_encode_decode_last_alarm_timestamp_map(self):
     comm = CommonForTest()
     enc_func = testutils.get_priv_attr(
                     comm, "__encode_last_alarm_timestamp_map", "Common")
     source = {"ABCDEFG": 1, "2345": "foo"}
     encoded = enc_func(source)
     self.__assert_decode_last_alarm_timestamp_map(encoded, source)
开发者ID:nanuyokakinu,项目名称:hatohol,代码行数:7,代码来源:TestHap2Ceilometer.py

示例8: test_acknowledge

 def test_acknowledge(self):
     destination_queue = DummyQueue()
     test_id = "test"
     self.__dispatcher.attach_destination(destination_queue, test_id)
     acknowledge = testutils.get_priv_attr(self.__dispatcher, "__acknowledge")
     test_message = (test_id, 1)
     testutils.assertNotRaises(acknowledge, test_message)
开发者ID:AokiTakumi,项目名称:hatohol,代码行数:7,代码来源:TestHaplib.py

示例9: test_set_dispatch_queue

 def test_set_dispatch_queue(self):
     hapiproc = self.__create_test_instance()
     test_dispatch_queue = DummyQueue()
     hapiproc.set_dispatch_queue(test_dispatch_queue)
     self.assertEquals(
         testutils.get_priv_attr(hapiproc, "__dispatch_queue"),
         test_dispatch_queue)
开发者ID:Rkumagaya,项目名称:hatohol,代码行数:7,代码来源:TestHaplib.py

示例10: __assert_get_resource

 def __assert_get_resource(self, num_items, expect):
     comm = CommonForTest({"href1_num_items": num_items})
     get_resource = \
         testutils.get_priv_attr(comm, "__get_resource", "Common")
     rel = None
     href = "http://HREF/href1"
     self.assertEquals(get_resource(rel, href), expect)
开发者ID:nanuyokakinu,项目名称:hatohol,代码行数:7,代码来源:TestHap2Ceilometer.py

示例11: test__publish_with_exception

 def test__publish_with_exception(self):
     conn = RabbitMQConnector()
     testutils.set_priv_attr(conn, "__publish_raw", None)
     target_func = testutils.get_priv_attr(conn, "__publish")
     with self.assertRaises(hap.Signal) as cm:
         target_func("msg")
     self.assertTrue(cm.exception.critical)
开发者ID:nanuyokakinu,项目名称:hatohol,代码行数:7,代码来源:TestRabbitMQConnector.py

示例12: __assert_parse_alarm_host

 def __assert_parse_alarm_host(self, threshold_rule,  expect,
                               host_cache=None):
     comm = CommonForTest()
     if host_cache is not None:
         comm.set_host_cache(host_cache)
     target_func = testutils.get_priv_attr(
                         comm, "__parse_alarm_host", "Common")
     self.assertEquals(target_func(threshold_rule), expect)
开发者ID:nanuyokakinu,项目名称:hatohol,代码行数:8,代码来源:TestHap2Ceilometer.py

示例13: test_poll_in_block

 def test_poll_in_block(self):
     poll_in_try_block = testutils.get_priv_attr(self.poller, "__poll_in_try_block")
     arm_info = haplib.ArmInfo()
     self.poller.set_dispatch_queue(DummyQueue())
     self.poller._HapiProcessor__reply_queue = DummyQueue()
     org_q = self.poller._BasePoller__command_queue._CommandQueue__q
     self.poller._BasePoller__command_queue._CommandQueue__q = DummyCommandQueue()
     testutils.assertNotRaises(poll_in_try_block, arm_info)
     self.poller._BasePoller__command_queue._CommandQueue__q = org_q
开发者ID:AokiTakumi,项目名称:hatohol,代码行数:9,代码来源:TestHaplib.py

示例14: test_dispatch_receive_response

    def test_dispatch_receive_response(self):
        destination_queue = DummyQueue()
        test_id = "test"
        test_contents = haplib.ParsedMessage()
        test_contents.message_id = 1

        self.__dispatcher.attach_destination(destination_queue, test_id)
        acknowledge = testutils.get_priv_attr(self.__dispatcher, "__acknowledge")
        test_message = (test_id, test_contents.message_id)
        acknowledge(test_message)

        test_message = (test_id, test_contents)
        dispatch_queue = testutils.get_priv_attr(self.__dispatcher, "__dispatch_queue")
        dispatch_queue.put(test_message)

        testutils.assertNotRaises(acknowledge, test_message)
        dispatch = testutils.get_priv_attr(self.__dispatcher, "__dispatch")
        testutils.assertNotRaises(dispatch)
开发者ID:AokiTakumi,项目名称:hatohol,代码行数:18,代码来源:TestHaplib.py

示例15: test_remove_missing_alarm_before_get_all_alarms

 def test_remove_missing_alarm_before_get_all_alarms(self):
     comm = CommonForTest()
     target_func = testutils.get_priv_attr(comm, "__remove_missing_alarm",
                                           "Common")
     alarm_time_map = {"alarm1": "20120222101011.123456",
                       "alarm2": "20120322121311.123456",
     }
     target_func(alarm_time_map)
     self.assertEquals(len(alarm_time_map), 2)
开发者ID:nanuyokakinu,项目名称:hatohol,代码行数:9,代码来源:TestHap2Ceilometer.py


注:本文中的testutils.get_priv_attr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。