Simplify tests
This commit is contained in:
parent
14792472db
commit
32568a6da4
@ -27,6 +27,7 @@ import shutil
|
|||||||
|
|
||||||
import attr
|
import attr
|
||||||
from PyQt5.QtCore import pyqtSignal, QPoint, QProcess, QObject, QUrl
|
from PyQt5.QtCore import pyqtSignal, QPoint, QProcess, QObject, QUrl
|
||||||
|
from PyQt5.QtGui import QIcon
|
||||||
from PyQt5.QtNetwork import (QNetworkRequest, QAbstractNetworkCache,
|
from PyQt5.QtNetwork import (QNetworkRequest, QAbstractNetworkCache,
|
||||||
QNetworkCacheMetaData)
|
QNetworkCacheMetaData)
|
||||||
from PyQt5.QtWidgets import QCommonStyle, QLineEdit, QWidget, QTabBar
|
from PyQt5.QtWidgets import QCommonStyle, QLineEdit, QWidget, QTabBar
|
||||||
@ -267,7 +268,7 @@ class FakeWebTab(browsertab.AbstractTab):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def icon(self):
|
def icon(self):
|
||||||
return self.windowIcon()
|
return QIcon()
|
||||||
|
|
||||||
|
|
||||||
class FakeSignal:
|
class FakeSignal:
|
||||||
|
@ -211,8 +211,11 @@ class TestYaml:
|
|||||||
data = autoconfig.read()
|
data = autoconfig.read()
|
||||||
assert data == {'tabs.show': {'global': 'value'}}
|
assert data == {'tabs.show': {'global': 'value'}}
|
||||||
|
|
||||||
@pytest.mark.parametrize('persist', [True, False])
|
@pytest.mark.parametrize('persist, expected', [
|
||||||
def test_merge_persist(self, yaml, autoconfig, persist):
|
(True, 'persist'),
|
||||||
|
(False, 'normal'),
|
||||||
|
])
|
||||||
|
def test_merge_persist(self, yaml, autoconfig, persist, expected):
|
||||||
"""Tests for migration of tabs.persist_mode_on_change."""
|
"""Tests for migration of tabs.persist_mode_on_change."""
|
||||||
autoconfig.write({'tabs.persist_mode_on_change': {'global': persist}})
|
autoconfig.write({'tabs.persist_mode_on_change': {'global': persist}})
|
||||||
yaml.load()
|
yaml.load()
|
||||||
@ -220,8 +223,7 @@ class TestYaml:
|
|||||||
|
|
||||||
data = autoconfig.read()
|
data = autoconfig.read()
|
||||||
assert 'tabs.persist_mode_on_change' not in data
|
assert 'tabs.persist_mode_on_change' not in data
|
||||||
mode = 'persist' if persist else 'normal'
|
assert data['tabs.mode_on_change']['global'] == expected
|
||||||
assert data['tabs.mode_on_change']['global'] == mode
|
|
||||||
|
|
||||||
def test_bindings_default(self, yaml, autoconfig):
|
def test_bindings_default(self, yaml, autoconfig):
|
||||||
"""Make sure bindings.default gets removed from autoconfig.yml."""
|
"""Make sure bindings.default gets removed from autoconfig.yml."""
|
||||||
@ -233,9 +235,14 @@ class TestYaml:
|
|||||||
data = autoconfig.read()
|
data = autoconfig.read()
|
||||||
assert 'bindings.default' not in data
|
assert 'bindings.default' not in data
|
||||||
|
|
||||||
@pytest.mark.parametrize('show',
|
@pytest.mark.parametrize('show, expected', [
|
||||||
[True, False, 'always', 'never', 'pinned'])
|
(True, 'always'),
|
||||||
def test_tabs_favicons_show(self, yaml, autoconfig, show):
|
(False, 'never'),
|
||||||
|
('always', 'always'),
|
||||||
|
('never', 'never'),
|
||||||
|
('pinned', 'pinned'),
|
||||||
|
])
|
||||||
|
def test_tabs_favicons_show(self, yaml, autoconfig, show, expected):
|
||||||
"""Tests for migration of tabs.favicons.show."""
|
"""Tests for migration of tabs.favicons.show."""
|
||||||
autoconfig.write({'tabs.favicons.show': {'global': show}})
|
autoconfig.write({'tabs.favicons.show': {'global': show}})
|
||||||
|
|
||||||
@ -243,11 +250,7 @@ class TestYaml:
|
|||||||
yaml._save()
|
yaml._save()
|
||||||
|
|
||||||
data = autoconfig.read()
|
data = autoconfig.read()
|
||||||
if isinstance(show, bool):
|
assert data['tabs.favicons.show']['global'] == expected
|
||||||
when = 'always' if show else 'never'
|
|
||||||
else:
|
|
||||||
when = show
|
|
||||||
assert data['tabs.favicons.show']['global'] == when
|
|
||||||
|
|
||||||
def test_renamed_key_unknown_target(self, monkeypatch, yaml,
|
def test_renamed_key_unknown_target(self, monkeypatch, yaml,
|
||||||
autoconfig):
|
autoconfig):
|
||||||
|
Loading…
Reference in New Issue
Block a user