コード例 #1
0
ファイル: test_hub.py プロジェクト: pombredanne/heyu
    def test_no_endpoints_v4(self, mock_daemonize, mock_parse_hub):
        args = mock.Mock(
            endpoints=[],
            daemon=True,
            debug=False,
            pid_file=None,
        )

        hub._normalize_args(args)

        self.assertEqual([('', util.HEYU_PORT)], args.endpoints)
        self.assertFalse(mock_parse_hub.called)
        mock_daemonize.assert_called_once_with(pidfile=None)
コード例 #2
0
ファイル: test_hub.py プロジェクト: pombredanne/heyu
    def test_daemonize_nodaemon(self, mock_daemonize, mock_parse_hub):
        args = mock.Mock(
            endpoints=[],
            daemon=False,
            debug=False,
            pid_file=None,
        )

        hub._normalize_args(args)

        self.assertEqual([('', util.HEYU_PORT), ('::', util.HEYU_PORT)],
                         args.endpoints)
        self.assertFalse(mock_parse_hub.called)
        self.assertFalse(mock_daemonize.called)
コード例 #3
0
ファイル: test_hub.py プロジェクト: pombredanne/heyu
    def test_with_endpoints(self, mock_daemonize, mock_parse_hub):
        args = mock.Mock(
            endpoints=['ep1', 'ep2', 'ep3'],
            daemon=True,
            debug=False,
            pid_file=None,
        )

        hub._normalize_args(args)

        self.assertEqual([('ep1', 1234), ('ep2', 1234), ('ep3', 1234)],
                         args.endpoints)
        mock_parse_hub.assert_has_calls([
            mock.call('ep1'),
            mock.call('ep2'),
            mock.call('ep3'),
        ])
        mock_daemonize.assert_called_once_with(pidfile=None)