From 579bc96b365e3a37841181aa52d081624cd26159 Mon Sep 17 00:00:00 2001
From: Florian Spreckelsen <f.spreckelsen@indiscale.com>
Date: Thu, 28 Nov 2024 14:50:16 +0100
Subject: [PATCH] TST: modernize symlink test

---
 tests/test_file.py | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/tests/test_file.py b/tests/test_file.py
index 9072b23..af0349f 100644
--- a/tests/test_file.py
+++ b/tests/test_file.py
@@ -535,10 +535,9 @@ def test_insert_files_in_dir_with_symlink():
             flags={
                 "InsertFilesInDir": path_on_server +
                 "linked_subfolder"})
-        assert_is_not_none(c.messages["Warning", 6])
-        assert_equal(c.messages["Warning", 6][0],
-                     "Directory or file is symbolic link: " + path_on_server +
-                     "linked_subfolder")
+        assert c.messages.get("Warning", 6, exact=True) is not None
+        assert (c.messages.get("Warning", 6, exact=True).description ==
+                "Directory or file is symbolic link: " + path_on_server + "linked_subfolder")
 
         c = models.Container()
         c.retrieve(
@@ -548,11 +547,11 @@ def test_insert_files_in_dir_with_symlink():
                 "InsertFilesInDir": "--force-allow-symlinks " +
                 path_on_server +
                 "linked_subfolder"})
-        assert_is_not_none(c.messages["Info", 0])
-        assert_equal(c.messages["Info", 0][0],
-                     "Files count in linked_subfolder/: 1")
+        assert c.messages.get("Info", 0, exact=True) is not None
+        assert c.messages.get(
+            "Info", 0, exact=True).description == "Files count in linked_subfolder/: 1"
         assert c[0].name is None
-        assert_equal(c[0].path, "/linked_subfolder/test2.dat")
+        assert c[0].path == "/linked_subfolder/test2.dat"
 
         d = models.Container()
         d.insert(
@@ -562,12 +561,12 @@ def test_insert_files_in_dir_with_symlink():
                 "InsertFilesInDir": "--force-allow-symlinks " +
                 path_on_server +
                 "linked_subfolder"})
-        assert_is_not_none(c.messages["Info", 0])
-        assert_equal(d.messages["Info", 0][0],
-                     "Files count in linked_subfolder/: 1")
-        assert_true(d[0].is_valid())
+        assert d.messages.get("Info", 0, exact=True) is not None
+        assert d.messages.get(
+            "Info", 0, exact=True).description == "Files count in linked_subfolder/: 1"
+        assert d[0].is_valid() is True
         assert d[0].name is None
-        assert_equal(d[0].path, "/linked_subfolder/test2.dat")
+        assert d[0].path == "/linked_subfolder/test2.dat"
 
     finally:
         try:
-- 
GitLab