Example #1
0
    def test_no_hub_resolv(self, mock_parse_hub, mock_open, mock_expanduser):
        result = util.default_hub()

        self.assertEqual(('127.0.0.1', util.HEYU_PORT), result)
        mock_open.assert_called_once_with('/home/user/.heyu.hub')
        mock_parse_hub.assert_called_once_with('hub')
Example #2
0
    def test_default_hub(self, mock_parse_hub, mock_open, mock_expanduser):
        result = util.default_hub()

        self.assertEqual(('1.2.3.4', 1234), result)
        mock_open.assert_called_once_with('/home/user/.heyu.hub')
        mock_parse_hub.assert_called_once_with('hub')
Example #3
0
        :param summary: The summary for the notification.
        :param body: The body text for the notification.
        :param category: One of the values CONNECTED, DISCONNECTED, or
                         ERROR.  This will be used to set the category
                         of the generated notification.
        """

        msg = protocol.Message('notify', summary=summary, body=body,
                               category=category, app_name=self.app_name,
                               id=self.app_id)
        self.server.notify(msg)


@cli_tools.argument('--host', '-H',
                    dest='hub',
                    default=util.default_hub(),
                    type=util.parse_hub,
                    help='Specifies the HeyU hub to subscribe to '
                    'notifications from, as "hostname" or "hostname:port".')
@cli_tools.argument('--cert-conf', '-C',
                    default=None,
                    help='Specifies an alternate path to the certificate '
                    'configuration file.')
@cli_tools.argument('--insecure', '-k',
                    dest='secure',
                    default=True,
                    action='store_false',
                    help='Specifies that SSL should not be used to connect '
                    'to the hub.')
@cli_tools.argument('--debug', '-d',
                    help='Enables debugging.')