diff options
author | Florian Bruhin <me@the-compiler.org> | 2018-09-06 17:17:31 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2018-09-06 17:26:28 +0200 |
commit | d4f16f88b6e7ec53c37fd62294ac6a4a971d4ddf (patch) | |
tree | 9ff40459d56ede0741565cef4b52ec9987b52162 /tests/unit/browser/test_history.py | |
parent | ec774379bdfe2de47804f8bd529014b253c0b1ec (diff) | |
download | qutebrowser-d4f16f88b6e7ec53c37fd62294ac6a4a971d4ddf.tar.gz qutebrowser-d4f16f88b6e7ec53c37fd62294ac6a4a971d4ddf.zip |
Remove support for importing pre-v1.0.0 history
Diffstat (limited to 'tests/unit/browser/test_history.py')
-rw-r--r-- | tests/unit/browser/test_history.py | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/tests/unit/browser/test_history.py b/tests/unit/browser/test_history.py index 0dc97f316..40dce3ec4 100644 --- a/tests/unit/browser/test_history.py +++ b/tests/unit/browser/test_history.py @@ -323,99 +323,6 @@ class TestInit: assert default_interface is None -class TestImport: - - def test_import_txt(self, hist, data_tmpdir, monkeypatch, stubs): - monkeypatch.setattr(history, 'QTimer', stubs.InstaTimer) - histfile = data_tmpdir / 'history' - # empty line is deliberate, to test skipping empty lines - histfile.write('''12345 http://example.com/ title - 12346 http://qutebrowser.org/ - 67890 http://example.com/path - - 68891-r http://example.com/path/other ''') - - hist.import_txt() - - assert list(hist) == [ - ('http://example.com/', 'title', 12345, False), - ('http://qutebrowser.org/', '', 12346, False), - ('http://example.com/path', '', 67890, False), - ('http://example.com/path/other', '', 68891, True) - ] - - assert not histfile.exists() - assert (data_tmpdir / 'history.bak').exists() - - def test_existing_backup(self, hist, data_tmpdir, monkeypatch, stubs): - monkeypatch.setattr(history, 'QTimer', stubs.InstaTimer) - histfile = data_tmpdir / 'history' - bakfile = data_tmpdir / 'history.bak' - histfile.write('12345 http://example.com/ title') - bakfile.write('12346 http://qutebrowser.org/') - - hist.import_txt() - - assert list(hist) == [('http://example.com/', 'title', 12345, False)] - - assert not histfile.exists() - assert bakfile.read().split('\n') == ['12346 http://qutebrowser.org/', - '12345 http://example.com/ title'] - - @pytest.mark.parametrize('line', [ - '', - '#12345 http://example.com/commented', - - # https://bugreports.qt.io/browse/QTBUG-60364 - '12345 http://.com/', - '12345 https://.com/', - '12345 http://www..com/', - '12345 https://www..com/', - - # issue #2646 - ('12345 data:text/html;' - 'charset=UTF-8,%3C%21DOCTYPE%20html%20PUBLIC%20%22-'), - ]) - def test_skip(self, hist, data_tmpdir, monkeypatch, stubs, line): - """import_txt should skip certain lines silently.""" - monkeypatch.setattr(history, 'QTimer', stubs.InstaTimer) - histfile = data_tmpdir / 'history' - histfile.write(line) - - hist.import_txt() - - assert not histfile.exists() - assert not len(hist) - - @pytest.mark.parametrize('line', [ - 'xyz http://example.com/bad-timestamp', - '12345', - 'http://example.com/no-timestamp', - '68891-r-r http://example.com/double-flag', - '68891-x http://example.com/bad-flag', - '68891 http://.com', - ]) - def test_invalid(self, hist, data_tmpdir, monkeypatch, stubs, caplog, - line): - """import_txt should fail on certain lines.""" - monkeypatch.setattr(history, 'QTimer', stubs.InstaTimer) - histfile = data_tmpdir / 'history' - histfile.write(line) - - with caplog.at_level(logging.ERROR): - hist.import_txt() - - assert any(rec.msg.startswith("Failed to import history:") - for rec in caplog.records) - - assert histfile.exists() - - def test_nonexistent(self, hist, data_tmpdir, monkeypatch, stubs): - """import_txt should do nothing if the history file doesn't exist.""" - monkeypatch.setattr(history, 'QTimer', stubs.InstaTimer) - hist.import_txt() - - class TestDump: def test_debug_dump_history(self, hist, tmpdir): |