2015-05-25 01:31:50 +02:00
|
|
|
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
|
|
|
|
2016-01-04 07:12:39 +01:00
|
|
|
# Copyright 2015-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
2015-05-25 01:31:50 +02:00
|
|
|
#
|
|
|
|
# This file is part of qutebrowser.
|
|
|
|
#
|
|
|
|
# qutebrowser is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# qutebrowser is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
"""Tests for qutebrowser.browser.commands."""
|
|
|
|
|
|
|
|
import collections
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
2015-08-16 23:20:30 +02:00
|
|
|
from qutebrowser.browser import commands
|
2015-05-25 01:31:50 +02:00
|
|
|
from qutebrowser.mainwindow import tabbedbrowser
|
|
|
|
from qutebrowser.utils import objreg
|
2015-07-20 11:23:34 +02:00
|
|
|
from qutebrowser.keyinput import modeman
|
2015-05-25 01:31:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
ObjectsRet = collections.namedtuple('Dispatcher', ['tb', 'cd'])
|
|
|
|
|
2015-08-30 23:11:23 +02:00
|
|
|
pytestmark = pytest.mark.usefixtures('cookiejar_and_cache')
|
2015-05-25 01:31:50 +02:00
|
|
|
|
|
|
|
|
2015-07-20 11:23:34 +02:00
|
|
|
@pytest.yield_fixture
|
|
|
|
def objects(qtbot, default_config, key_config_stub, tab_registry,
|
|
|
|
host_blocker_stub):
|
2015-05-25 01:31:50 +02:00
|
|
|
"""Fixture providing a CommandDispatcher and a fake TabbedBrowser."""
|
|
|
|
win_id = 0
|
2015-07-20 11:23:34 +02:00
|
|
|
modeman.init(win_id, parent=None)
|
2015-05-25 01:31:50 +02:00
|
|
|
tabbed_browser = tabbedbrowser.TabbedBrowser(win_id)
|
|
|
|
qtbot.add_widget(tabbed_browser)
|
2015-07-20 11:23:34 +02:00
|
|
|
objreg.register('tabbed-browser', tabbed_browser, scope='window',
|
|
|
|
window=win_id)
|
2015-05-25 01:31:50 +02:00
|
|
|
dispatcher = commands.CommandDispatcher(win_id, tabbed_browser)
|
2015-07-20 11:23:34 +02:00
|
|
|
objreg.register('command-dispatcher', dispatcher, scope='window',
|
|
|
|
window=win_id)
|
|
|
|
yield ObjectsRet(tabbed_browser, dispatcher)
|
2015-05-25 01:31:50 +02:00
|
|
|
|
|
|
|
|
2015-08-16 22:51:00 +02:00
|
|
|
@pytest.mark.skipif(True, reason="Work in progress")
|
2015-05-25 01:31:50 +02:00
|
|
|
def test_openurl(objects):
|
2015-07-20 11:23:34 +02:00
|
|
|
objects.cd.openurl('localhost')
|