From 3c2bc670ff8c66f1d087b5761399f7a9eb20275f Mon Sep 17 00:00:00 2001 From: Lamar Pavel Date: Sat, 31 Oct 2015 16:31:47 +0100 Subject: [PATCH] Add test for alternate path of DiskCache.clear() --- tests/unit/browser/test_cache.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/unit/browser/test_cache.py b/tests/unit/browser/test_cache.py index 2e2772da4..05ef3db95 100644 --- a/tests/unit/browser/test_cache.py +++ b/tests/unit/browser/test_cache.py @@ -180,6 +180,16 @@ def test_cache_clear_activated(config_stub, tmpdir): assert disk_cache.cacheSize() == 0 +def test_cache_clear_deactivated(config_stub, tmpdir): + """Test method clear() on deactivated cache.""" + config_stub.data = { + 'storage': {'cache-size': 1024}, + 'general': {'private-browsing': True} + } + disk_cache = cache.DiskCache(str(tmpdir)) + assert disk_cache.clear() is None + + def test_cache_metadata(tmpdir): """Ensure that DiskCache.metaData() returns exactly what was inserted.""" url = 'http://qutebrowser.org'