about summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2019-01-27 03:02:23 +0100
committerWojciech Siewierski <wojciech.siewierski@onet.pl>2019-01-27 03:04:30 +0100
commit2c83766eec99bbcb577de78c8ebc39c83ab15b57 (patch)
treea3966a41931f2227a35b9238b54a07f50f48c0bf /tests
parent8374ae53f1604f887255bd6214aae2b40b03c6f8 (diff)
downloadranger-2c83766eec99bbcb577de78c8ebc39c83ab15b57.tar.gz
Refactor the bookmark validation code
Now it's trivial for the test module to mock the bookmark validation
without introducing too much logic about this mocking to the actual class.
Diffstat (limited to 'tests')
-rw-r--r--tests/ranger/container/test_bookmarks.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/ranger/container/test_bookmarks.py b/tests/ranger/container/test_bookmarks.py
index 8c62bd23..84ac42c2 100644
--- a/tests/ranger/container/test_bookmarks.py
+++ b/tests/ranger/container/test_bookmarks.py
@@ -8,11 +8,16 @@ import pytest
 from ranger.container.bookmarks import Bookmarks
 
 
+class NotValidatedBookmarks(Bookmarks):
+    def _validate(self, value):
+        return True
+
+
 def testbookmarks(tmpdir):
     # Bookmarks point to directory location and allow fast access to
     # 'favorite' directories. They are persisted to a bookmark file, plain text.
     bookmarkfile = tmpdir.join("bookmarkfile")
-    bmstore = Bookmarks(str(bookmarkfile), validate=False)
+    bmstore = NotValidatedBookmarks(str(bookmarkfile))
 
     # loading an empty bookmark file doesnot crash
     bmstore.load()
@@ -33,7 +38,7 @@ def testbookmarks(tmpdir):
 
     # We can persist bookmarks to disk and restore them from disk
     bmstore.save()
-    secondstore = Bookmarks(str(bookmarkfile), validate=False)
+    secondstore = NotValidatedBookmarks(str(bookmarkfile))
     secondstore.load()
     assert "'" in secondstore
     assert secondstore["'"] == "the milk"