summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorlufte <javier@lufte.net>2021-07-02 22:18:12 -0300
committerlufte <javier@lufte.net>2021-07-02 22:18:12 -0300
commit03b8a266455b2cfd0484e1d16ba7e6370ae49655 (patch)
tree0ac496bdc7e285ddb9d327056f01f6b66793b8cf /tests
parentb75d23e0b1ad305a681847107bdaff5b870e1fef (diff)
downloadqutebrowser-03b8a266455b2cfd0484e1d16ba7e6370ae49655.tar.gz
qutebrowser-03b8a266455b2cfd0484e1d16ba7e6370ae49655.zip
The database of a table shouldn't be private
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/browser/test_history.py2
-rw-r--r--tests/unit/completion/test_histcategory.py18
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/unit/browser/test_history.py b/tests/unit/browser/test_history.py
index 904a86a5f..0454fb722 100644
--- a/tests/unit/browser/test_history.py
+++ b/tests/unit/browser/test_history.py
@@ -528,7 +528,7 @@ class TestCompletionMetaInfo:
assert not metainfo['force_rebuild']
def test_recovery_no_table(self, metainfo):
- metainfo._database.query("DROP TABLE CompletionMetaInfo").run()
+ metainfo.database.query("DROP TABLE CompletionMetaInfo").run()
with pytest.raises(sql.BugError, match='no such table: CompletionMetaInfo'):
metainfo['force_rebuild']
diff --git a/tests/unit/completion/test_histcategory.py b/tests/unit/completion/test_histcategory.py
index 4e3b657e2..cb37fb784 100644
--- a/tests/unit/completion/test_histcategory.py
+++ b/tests/unit/completion/test_histcategory.py
@@ -100,7 +100,7 @@ def test_set_pattern(pattern, before, after, model_validator, hist):
"""Validate the filtering and sorting results of set_pattern."""
for row in before:
hist.insert({'url': row[0], 'title': row[1], 'last_atime': 1})
- cat = histcategory.HistoryCategory(database=hist._database)
+ cat = histcategory.HistoryCategory(database=hist.database)
model_validator.set_model(cat)
cat.set_pattern(pattern)
model_validator.validate(after)
@@ -111,7 +111,7 @@ def test_set_pattern_repeated(model_validator, hist):
hist.insert({'url': 'example.com/foo', 'title': 'title1', 'last_atime': 1})
hist.insert({'url': 'example.com/bar', 'title': 'title2', 'last_atime': 1})
hist.insert({'url': 'example.com/baz', 'title': 'title3', 'last_atime': 1})
- cat = histcategory.HistoryCategory(database=hist._database)
+ cat = histcategory.HistoryCategory(database=hist.database)
model_validator.set_model(cat)
cat.set_pattern('b')
@@ -144,7 +144,7 @@ def test_set_pattern_repeated(model_validator, hist):
], ids=['numbers', 'characters'])
def test_set_pattern_long(hist, message_mock, caplog, pattern):
hist.insert({'url': 'example.com/foo', 'title': 'title1', 'last_atime': 1})
- cat = histcategory.HistoryCategory(database=hist._database)
+ cat = histcategory.HistoryCategory(database=hist.database)
with caplog.at_level(logging.ERROR):
cat.set_pattern(pattern)
msg = message_mock.getmsg(usertypes.MessageLevel.error)
@@ -154,7 +154,7 @@ def test_set_pattern_long(hist, message_mock, caplog, pattern):
@hypothesis.given(pat=strategies.text())
def test_set_pattern_hypothesis(hist, pat, caplog):
hist.insert({'url': 'example.com/foo', 'title': 'title1', 'last_atime': 1})
- cat = histcategory.HistoryCategory(database=hist._database)
+ cat = histcategory.HistoryCategory(database=hist.database)
with caplog.at_level(logging.ERROR):
cat.set_pattern(pat)
@@ -203,7 +203,7 @@ def test_sorting(max_items, before, after, model_validator, hist, config_stub):
for url, title, atime in before:
timestamp = datetime.datetime.strptime(atime, '%Y-%m-%d').timestamp()
hist.insert({'url': url, 'title': title, 'last_atime': timestamp})
- cat = histcategory.HistoryCategory(database=hist._database)
+ cat = histcategory.HistoryCategory(database=hist.database)
model_validator.set_model(cat)
cat.set_pattern('')
model_validator.validate(after)
@@ -212,7 +212,7 @@ def test_sorting(max_items, before, after, model_validator, hist, config_stub):
def test_remove_rows(hist, model_validator):
hist.insert({'url': 'foo', 'title': 'Foo', 'last_atime': 0})
hist.insert({'url': 'bar', 'title': 'Bar', 'last_atime': 0})
- cat = histcategory.HistoryCategory(database=hist._database)
+ cat = histcategory.HistoryCategory(database=hist.database)
model_validator.set_model(cat)
cat.set_pattern('')
hist.delete('url', 'foo')
@@ -228,7 +228,7 @@ def test_remove_rows_fetch(hist):
'title': [str(i) for i in range(300)],
'last_atime': [0] * 300,
})
- cat = histcategory.HistoryCategory(database=hist._database)
+ cat = histcategory.HistoryCategory(database=hist.database)
cat.set_pattern('')
# sanity check that we didn't fetch everything up front
@@ -253,14 +253,14 @@ def test_timestamp_fmt(fmt, expected, model_validator, config_stub, data_tmpdir)
hist = sql.SqlTable(db, 'CompletionHistory', ['url', 'title', 'last_atime'])
atime = datetime.datetime(2018, 2, 27, 8, 30)
hist.insert({'url': 'foo', 'title': '', 'last_atime': atime.timestamp()})
- cat = histcategory.HistoryCategory(database=hist._database)
+ cat = histcategory.HistoryCategory(database=hist.database)
model_validator.set_model(cat)
cat.set_pattern('')
model_validator.validate([('foo', '', expected)])
def test_skip_duplicate_set(message_mock, caplog, hist):
- cat = histcategory.HistoryCategory(database=hist._database)
+ cat = histcategory.HistoryCategory(database=hist.database)
cat.set_pattern('foo')
cat.set_pattern('foobarbaz')
msg = caplog.messages[-1]