about summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2018-12-19 18:39:43 +0100
committerGitHub <noreply@github.com>2018-12-19 18:39:43 +0100
commit7f20f31379eec35b97c138186d11d0265c9429f3 (patch)
treedc792de0f2ddcbdcd091d93ac3af49740710ef0a /tests
parentbae44ae3c7440c00acf65ba4c26a0fd2a0f78c3a (diff)
parentec048e93fe0a4b7d2079c0af1364574906da9e7f (diff)
downloadranger-7f20f31379eec35b97c138186d11d0265c9429f3.tar.gz
Merge pull request #1408 from husjon/bookmarks-symlink
Added check if bookmark file is a symlink.
Diffstat (limited to 'tests')
-rw-r--r--tests/ranger/container/test_bookmarks.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ranger/container/test_bookmarks.py b/tests/ranger/container/test_bookmarks.py
index 6fba2a3d..64192c06 100644
--- a/tests/ranger/container/test_bookmarks.py
+++ b/tests/ranger/container/test_bookmarks.py
@@ -56,3 +56,20 @@ def testbookmarks(tmpdir):
         secondstore.update_if_outdated()
     secondstore.update = origupdate
     secondstore.update_if_outdated()
+
+
+def test_bookmark_symlink(tmpdir):
+    # Initialize plain file and symlink paths
+    bookmarkfile_link = tmpdir.join("bookmarkfile")
+    bookmarkfile_orig = tmpdir.join("bookmarkfile.orig")
+
+    # Create symlink pointing towards the original plain file.
+    os.symlink(str(bookmarkfile_orig), str(bookmarkfile_link))
+
+    # Initialize the bookmark file and save the file.
+    bmstore = Bookmarks(str(bookmarkfile_link))
+    bmstore.save()
+
+    # Once saved, the bookmark file should still be a symlink pointing towards the plain file.
+    assert os.path.islink(str(bookmarkfile_link))
+    assert not os.path.islink(str(bookmarkfile_orig))