Example #1
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}
     testutils.assertNotRaises(self.__main_plugin.hap_update_monitoring_server_info,
                            test_params)
Example #2
0
 def test_put_history(self):
     self.reply_queue.put(True)
     fetch_id = 543
     item_id = 111
     samples = [{"value": "123", "time": "20150321151321"}]
     testutils.assertNotRaises(self.processor.put_history, samples, item_id,
                               fetch_id)
Example #3
0
 def test_put_history(self):
     self.reply_queue.put(True)
     fetch_id = 543
     item_id = 111
     samples = [{"value": "123", "time": "20150321151321"}]
     testutils.assertNotRaises(self.processor.put_history,
                            samples, item_id, fetch_id)
Example #4
0
 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)
Example #5
0
 def test_hap_fetch_history(self):
     params = {
         "itemId": "1",
         "beginTime": None,
         "endTime": None,
         "fetchId": 1
     }
     testutils.assertNotRaises(self.main.hap_fetch_history, params, 1)
Example #6
0
 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)
Example #7
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"

        testutils.assertNotRaises(haplib.Utils.load_transporter,
                               test_transport_arguments)
Example #8
0
 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
Example #9
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 = 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)
Example #10
0
 def test_check_error_dict_success(self):
     error_dict = {
         "error": {
             "code": 1,
             "message": "test_message",
             "data": "test_data"
         },
         "id": 1
     }
     testutils.assertNotRaises(haplib.Utils.__check_error_dict, error_dict)
Example #11
0
 def test_check_error_dict_success(self):
     error_dict = {
         "error": {
             "code": 1,
             "message": "test_message",
             "data": "test_data"
         },
         "id": 1
     }
     check_error_dict = self.receiver.__check_error_dict
     testutils.assertNotRaises(check_error_dict, error_dict)
Example #12
0
 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
Example #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 = 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)
Example #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
     }
     testutils.assertNotRaises(
         self.__main_plugin.hap_update_monitoring_server_info, test_params)
Example #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 = 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)
Example #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 = 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)
Example #17
0
 def test_poll(self):
     testutils.assertNotRaises(self.poller.poll)
Example #18
0
 def test_daemonize(self):
     dispatcher = DispatcherForTest()
     testutils.assertNotRaises(dispatcher.daemonize)
Example #19
0
 def test_daemonize(self):
     dispatcher = DispatcherForTest()
     testutils.assertNotRaises(dispatcher.daemonize)
Example #20
0
 def test_messenger_get_broken_error(self):
     messenger = testutils.get_priv_attr(self.receiver, "__messenger")
     testutils.assertNotRaises(messenger, None, '{"error": "test"}')
Example #21
0
 def test_daemonize(self):
     testutils.assertNotRaises(self.receiver.daemonize)
Example #22
0
 def test_poll_triggers(self):
     testutils.assertNotRaises(self.poller.poll_triggers)
Example #23
0
 def test_call(self):
     dispatcher = DispatcherForTest()
     testutils.assertNotRaises(dispatcher)
Example #24
0
 def test_register_callback(self):
     testutils.assertNotRaises(self.__main_plugin.register_callback,
                               "test_code", "test_handler")
Example #25
0
 def test_poll(self):
     testutils.assertNotRaises(self.poller.poll)
Example #26
0
 def test_start_dispatcher(self):
     self.__main_plugin._HapiProcessor__dispatcher = DispatcherForTest()
     testutils.assertNotRaises(self.__main_plugin.start_dispatcher)
Example #27
0
 def test_start_receiver(self):
     testutils.assertNotRaises(self.__main_plugin.start_receiver)
Example #28
0
 def test_request_exit(self):
     testutils.assertNotRaises(self.__main_plugin.request_exit)
Example #29
0
 def test_register_callback(self):
     testutils.assertNotRaises(self.__main_plugin.register_callback, "test_code", "test_handler")
Example #30
0
 def test_return_error(self):
     testutils.assertNotRaises(self.__main_plugin.hap_return_error, -32700, 1)
Example #31
0
 def test_start_receiver(self):
     testutils.assertNotRaises(self.__main_plugin.start_receiver)
Example #32
0
 def test_poll_setup(self):
     testutils.assertNotRaises(self.poller.poll_setup)
Example #33
0
 def test_poll_host_groups(self):
     testutils.assertNotRaises(self.poller.poll_host_groups)
Example #34
0
 def test_poll_host_groups(self):
     testutils.assertNotRaises(self.poller.poll_host_groups)
Example #35
0
 def test_on_aboted_poll(self):
     testutils.assertNotRaises(self.poller.on_aborted_poll)
Example #36
0
 def test_poll_host_group_membership(self):
     testutils.assertNotRaises(self.poller.poll_host_group_membership)
Example #37
0
 def test_messenger(self):
     messenger = testutils.get_priv_attr(self.receiver, "__messenger")
     testutils.assertNotRaises(messenger, None, "test_message")
Example #38
0
 def test_poll_triggers(self):
     testutils.assertNotRaises(self.poller.poll_triggers)
Example #39
0
 def test_call(self):
     testutils.assertNotRaises(self.receiver.__call__)
Example #40
0
 def test_poll_events(self):
     testutils.assertNotRaises(self.poller.poll_events)
Example #41
0
 def test_put_arm_info(self):
     hapiproc, connector = self.__create_test_instance(ConnectorForTest)
     hapiproc.get_reply_queue().put(True)
     testutils.assertNotRaises(hapiproc.put_arm_info, haplib.ArmInfo())
Example #42
0
 def test_on_aboted_poll(self):
     testutils.assertNotRaises(self.poller.on_aborted_poll)
Example #43
0
 def test_call(self):
     testutils.assertNotRaises(self.receiver.__call__)
Example #44
0
 def test_messenger_get_broken_error(self):
     messenger = testutils.get_priv_attr(self.receiver, "__messenger")
     testutils.assertNotRaises(messenger, None, '{"error": "test"}')
Example #45
0
 def test_call(self):
     dispatcher = DispatcherForTest()
     testutils.assertNotRaises(dispatcher)
Example #46
0
 def test_messenger(self):
     messenger = testutils.get_priv_attr(self.receiver, "__messenger")
     testutils.assertNotRaises(messenger, None, "test_message")
Example #47
0
 def test_return_error(self):
     testutils.assertNotRaises(self.__main_plugin.hap_return_error, -32700,
                               1)
 def test_ensure_connection(self):
     comm = CommonForTest()
     testutils.assertNotRaises(comm.ensure_connection)
Example #49
0
 def test_request_exit(self):
     testutils.assertNotRaises(self.__main_plugin.request_exit)
Example #50
0
 def test_define_arguments(self):
     test_parser = argparse.ArgumentParser()
     manager = transporter.Manager(None)
     testutils.assertNotRaises(manager.define_arguments, test_parser)
Example #51
0
 def test_start_dispatcher(self):
     self.__main_plugin._HapiProcessor__dispatcher = DispatcherForTest()
     testutils.assertNotRaises(self.__main_plugin.start_dispatcher)
Example #52
0
 def test_notifiy(self):
     transporter_args = {"class": transporter.Transporter}
     test_sender = haplib.Sender(transporter_args)
     testutils.assertNotRaises(test_sender.notify, "test_notify", 1)
Example #53
0
 def test_poll_setup(self):
     testutils.assertNotRaises(self.poller.poll_setup)
Example #54
0
 def test_constructor(self):
     testutils.assertNotRaises(haplib.ChildProcess)
Example #55
0
 def test_poll_host_group_membership(self):
     testutils.assertNotRaises(self.poller.poll_host_group_membership)
Example #56
0
 def test_put_arm_info(self):
     hapiproc, connector = self.__create_test_instance(ConnectorForTest)
     hapiproc.get_reply_queue().put(True)
     testutils.assertNotRaises(hapiproc.put_arm_info, haplib.ArmInfo())
Example #57
0
 def test_poll_events(self):
     testutils.assertNotRaises(self.poller.poll_events)
Example #58
0
 def test_constructor(self):
     testutils.assertNotRaises(haplib.ChildProcess)
 def test_constructor(self):
     testutils.assertNotRaises(Common)
Example #60
0
 def test_daemonize(self):
     testutils.assertNotRaises(self.receiver.daemonize)