Пример #1
0
 def test_put_history(self):
     self.reply_queue.put(True)
     fetch_id = 543
     item_id = 111
     samples = [{"value": "123", "time": "20150321151321"}]
     common.assertNotRaises(self.processor.put_history,
                            samples, item_id, fetch_id)
Пример #2
0
 def test_acknowledge(self):
     destination_queue = DummyQueue()
     test_id = "test"
     self.__dispatcher.attach_destination(destination_queue, test_id)
     acknowledge = common.returnPrivObj(self.__dispatcher, "__acknowledge")
     test_message = (test_id, 1)
     common.assertNotRaises(acknowledge, test_message)
Пример #3
0
 def test_put_history(self):
     self.reply_queue.put(True)
     fetch_id = 543
     item_id = 111
     samples = [{"value": "123", "time": "20150321151321"}]
     common.assertNotRaises(self.processor.put_history, samples, item_id,
                            fetch_id)
Пример #4
0
 def test_hap_update_monitoring_server_info(self):
     test_params = {"serverId": None, "url": None, "nickName": None,
                    "userName": None, "password": None,
                    "pollingIntervalSec": None, "retryIntervalSec": None,
                    "extendedInfo": None, "type": None}
     common.assertNotRaises(self.__main_plugin.hap_update_monitoring_server_info,
                            test_params)
Пример #5
0
 def test_acknowledge(self):
     destination_queue = DummyQueue()
     test_id = "test"
     self.__dispatcher.attach_destination(destination_queue, test_id)
     acknowledge = common.returnPrivObj(self.__dispatcher, "__acknowledge")
     test_message = (test_id, 1)
     common.assertNotRaises(acknowledge, test_message)
Пример #6
0
    def test_load_transporter(self):
        test_transport_arguments = namedtuple(
            "transport_argument", "transporter_module transporter")
        test_transport_arguments.transporter_module = "hatohol.haplib"
        test_transport_arguments.transporter = "RabbitMQHapiConnector"

        common.assertNotRaises(haplib.Utils.load_transporter,
                               test_transport_arguments)
Пример #7
0
    def test_load_transporter(self):
        test_transport_arguments = namedtuple("transport_argument",
                                              "transporter_module transporter")
        test_transport_arguments.transporter_module = "haplib"
        test_transport_arguments.transporter = "RabbitMQHapiConnector"

        common.assertNotRaises(haplib.Utils.load_transporter,
                               test_transport_arguments)
 def test_hap_fetch_history(self):
     params = {
         "itemId": "1",
         "beginTime": None,
         "endTime": None,
         "fetchId": 1
     }
     common.assertNotRaises(self.main.hap_fetch_history, params, 1)
Пример #9
0
 def test_poll_in_block(self):
     poll_in_try_block = common.returnPrivObj(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()
     common.assertNotRaises(poll_in_try_block, arm_info)
     self.poller._BasePoller__command_queue._CommandQueue__q = org_q
Пример #10
0
 def test_dispatch_receive_id_notification(self):
     destination_queue = DummyQueue()
     test_id = "test"
     test_contents = 1
     test_message = (test_id, test_contents)
     dispatch_queue = common.returnPrivObj(self.__dispatcher, "__dispatch_queue")
     dispatch_queue.put(test_message)
     self.__dispatcher.attach_destination(destination_queue, test_id)
     dispatch = common.returnPrivObj(self.__dispatcher, "__dispatch")
     common.assertNotRaises(dispatch)
Пример #11
0
 def test_check_error_dict_success(self):
     error_dict = {
         "error": {
             "code": 1,
             "message": "test_message",
             "data": "test_data"
         },
         "id": 1
     }
     common.assertNotRaises(haplib.Utils.__check_error_dict, error_dict)
Пример #12
0
 def test_poll_in_block(self):
     poll_in_try_block = common.returnPrivObj(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()
     common.assertNotRaises(poll_in_try_block, arm_info)
     self.poller._BasePoller__command_queue._CommandQueue__q = org_q
Пример #13
0
 def test_dispatch_receive_id_notification(self):
     destination_queue = DummyQueue()
     test_id = "test"
     test_contents = 1
     test_message = (test_id, test_contents)
     dispatch_queue = common.returnPrivObj(self.__dispatcher,
                                           "__dispatch_queue")
     dispatch_queue.put(test_message)
     self.__dispatcher.attach_destination(destination_queue, test_id)
     dispatch = common.returnPrivObj(self.__dispatcher, "__dispatch")
     common.assertNotRaises(dispatch)
Пример #14
0
 def test_hap_update_monitoring_server_info(self):
     test_params = {
         "serverId": None,
         "url": None,
         "nickName": None,
         "userName": None,
         "password": None,
         "pollingIntervalSec": None,
         "retryIntervalSec": None,
         "extendedInfo": None,
         "type": None
     }
     common.assertNotRaises(
         self.__main_plugin.hap_update_monitoring_server_info, test_params)
Пример #15
0
    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 = common.returnPrivObj(self.__dispatcher, "__acknowledge")
        test_message = (test_id, test_contents.message_id)
        acknowledge(test_message)

        test_message = (test_id, test_contents)
        dispatch_queue = common.returnPrivObj(self.__dispatcher, "__dispatch_queue")
        dispatch_queue.put(test_message)

        common.assertNotRaises(acknowledge, test_message)
        dispatch = common.returnPrivObj(self.__dispatcher, "__dispatch")
        common.assertNotRaises(dispatch)
Пример #16
0
    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 = common.returnPrivObj(self.__dispatcher, "__acknowledge")
        test_message = (test_id, test_contents.message_id)
        acknowledge(test_message)

        test_message = (test_id, test_contents)
        dispatch_queue = common.returnPrivObj(self.__dispatcher,
                                              "__dispatch_queue")
        dispatch_queue.put(test_message)

        common.assertNotRaises(acknowledge, test_message)
        dispatch = common.returnPrivObj(self.__dispatcher, "__dispatch")
        common.assertNotRaises(dispatch)
Пример #17
0
 def test_daemonize(self):
     dispatcher = DispatcherForTest()
     common.assertNotRaises(dispatcher.daemonize)
Пример #18
0
 def test_daemonize(self):
     common.assertNotRaises(self.receiver.daemonize)
Пример #19
0
 def test_messenger_get_broken_error(self):
     messenger = common.returnPrivObj(self.receiver, "__messenger")
     common.assertNotRaises(messenger, None, '{"error": "test"}')
Пример #20
0
 def test_wait_acknowledge(self):
     self.reply_queue.put(True)
     wait_acknowledge = common.returnPrivObj(self.processor,
                                             "__wait_acknowledge")
     common.assertNotRaises(wait_acknowledge, 1)
Пример #21
0
 def test_put_items(self):
     self.reply_queue.put(True)
     fetch_id = 543
     items = [{"itemId": "123", "host_id": "FOOOOOO"}]
     common.assertNotRaises(self.processor.put_items, items, fetch_id)
Пример #22
0
 def test_get_cached_event_last_info(self):
     self.reply_queue.put(True)
     common.assertNotRaises(self.processor.get_cached_event_last_info)
Пример #23
0
 def test_poll_triggers(self):
     common.assertNotRaises(self.poller.poll_triggers)
Пример #24
0
 def test_poll_host_group_membership(self):
     common.assertNotRaises(self.poller.poll_host_group_membership)
Пример #25
0
 def test_poll_host_groups(self):
     common.assertNotRaises(self.poller.poll_host_groups)
Пример #26
0
 def test_poll_setup(self):
     common.assertNotRaises(self.poller.poll_setup)
Пример #27
0
 def test_poll(self):
     common.assertNotRaises(self.poller.poll)
Пример #28
0
 def test_start_dispatcher(self):
     self.__main_plugin._HapiProcessor__dispatcher = DispatcherForTest()
     common.assertNotRaises(self.__main_plugin.start_dispatcher)
Пример #29
0
 def test_start_receiver(self):
     common.assertNotRaises(self.__main_plugin.start_receiver)
Пример #30
0
 def test_daemonize(self):
     dispatcher = DispatcherForTest()
     common.assertNotRaises(dispatcher.daemonize)
Пример #31
0
 def test_request_exit(self):
     common.assertNotRaises(self.__main_plugin.request_exit)
Пример #32
0
 def test_poll_triggers(self):
     common.assertNotRaises(self.poller.poll_triggers)
Пример #33
0
 def test_poll_events(self):
     common.assertNotRaises(self.poller.poll_events)
Пример #34
0
 def test_on_aboted_poll(self):
     common.assertNotRaises(self.poller.on_aborted_poll)
Пример #35
0
 def test_put_events(self):
     self.reply_queue.put(True)
     events = [{"eventId": 123, "test_events":"test"}]
     common.assertNotRaises(self.processor.put_events, events)
Пример #36
0
 def test_return_error(self):
     common.assertNotRaises(self.__main_plugin.hap_return_error, -32700, 1)
Пример #37
0
 def test_messenger_get_broken_error(self):
     messenger = common.returnPrivObj(self.receiver, "__messenger")
     common.assertNotRaises(messenger, None, '{"error": "test"}')
Пример #38
0
 def test_call(self):
     dispatcher = DispatcherForTest()
     common.assertNotRaises(dispatcher)
Пример #39
0
 def test_messenger(self):
     messenger = common.returnPrivObj(self.receiver, "__messenger")
     common.assertNotRaises(messenger, None, "test_message")
Пример #40
0
 def test_register_callback(self):
     common.assertNotRaises(self.__main_plugin.register_callback,
                            "test_code", "test_handler")
Пример #41
0
 def test_call(self):
     common.assertNotRaises(self.receiver.__call__)
Пример #42
0
 def test_start_receiver(self):
     common.assertNotRaises(self.__main_plugin.start_receiver)
Пример #43
0
 def test_messenger(self):
     messenger = common.returnPrivObj(self.receiver, "__messenger")
     common.assertNotRaises(messenger, None, "test_message")
Пример #44
0
 def test_poll(self):
     common.assertNotRaises(self.poller.poll)
Пример #45
0
 def test_call(self):
     dispatcher = DispatcherForTest()
     common.assertNotRaises(dispatcher)
Пример #46
0
 def test_poll_host_groups(self):
     common.assertNotRaises(self.poller.poll_host_groups)
Пример #47
0
 def test_return_error(self):
     common.assertNotRaises(self.__main_plugin.hap_return_error, -32700, 1)
Пример #48
0
 def test_register_callback(self):
     common.assertNotRaises(self.__main_plugin.register_callback,
                            "test_code", "test_handler")
Пример #49
0
 def test_request_exit(self):
     common.assertNotRaises(self.__main_plugin.request_exit)
Пример #50
0
 def test_on_aboted_poll(self):
     common.assertNotRaises(self.poller.on_aborted_poll)
Пример #51
0
 def test_start_dispatcher(self):
     self.__main_plugin._HapiProcessor__dispatcher = DispatcherForTest()
     common.assertNotRaises(self.__main_plugin.start_dispatcher)
Пример #52
0
 def test_daemonize(self):
     common.assertNotRaises(self.receiver.daemonize)
Пример #53
0
 def test_poll_setup(self):
     common.assertNotRaises(self.poller.poll_setup)
 def test_close_connection_without_connection(self):
     comm = Common()
     testutil.assertNotRaises(comm.close_connection)
Пример #55
0
 def test_poll_host_group_membership(self):
     common.assertNotRaises(self.poller.poll_host_group_membership)
Пример #56
0
 def test_constructor(self):
     testutils.assertNotRaises(Common)
Пример #57
0
 def test_poll_events(self):
     common.assertNotRaises(self.poller.poll_events)
Пример #58
0
 def test_call(self):
     common.assertNotRaises(self.receiver.__call__)
Пример #59
0
 def test_constructor(self):
     testutils.assertNotRaises(Common)
 def test_ensure_connection(self):
     comm = CommonForTest()
     testutil.assertNotRaises(comm.ensure_connection)