Exemple #1
0
def test_resolve_tab_index_no_active_window(stub_app_no_windows):
    with pytest.raises(cmdutils.CommandError) as excinfo:
        tabutils.resolve_tab_index("1")

    assert str(excinfo.value) == \
        "No window specified and couldn't find active window!"
Exemple #2
0
def test_resolve_tab_index_invalid_win_id(stub_tabs):
    with pytest.raises(cmdutils.CommandError) as excinfo:
        tabutils.resolve_tab_index("3/1")

    assert str(excinfo.value) == "There's no window with id 3!"
Exemple #3
0
def test_resolve_tab_index_substring_no_match(stub_tabs):
    with pytest.raises(cmdutils.CommandError) as excinfo:
        tabutils.resolve_tab_index("foobarbaz")

    assert str(excinfo.value) == "No matching tab for: foobarbaz"
Exemple #4
0
def test_resolve_tab_index_index(stub_app, stub_tabs):
    tab = tabutils.resolve_tab_index("1")

    assert tab.url() == QUrl("https://wiki.archlinux.org")
    assert tab.title() == "ArchWiki"
    assert tab.win_id == 1
Exemple #5
0
def test_resolve_tab_index_substring(stub_tabs):
    tab = tabutils.resolve_tab_index("github")

    assert tab.url() == QUrl("https://github.com")
    assert tab.title() == "GitHub"
    assert tab.win_id == 0