Bladeren bron

Fix case when read_permissions is called on unknown location

Yentl Van Tendeloo 7 jaren geleden
bovenliggende
commit
00022c2fca
2 gewijzigde bestanden met toevoegingen van 15 en 1 verwijderingen
  1. 1 1
      bootstrap/core_algorithm.alc
  2. 14 0
      unit/test_all.py

+ 1 - 1
bootstrap/core_algorithm.alc

@@ -1734,7 +1734,7 @@ String function cmd_read_permissions(location : String):
 			result = result + "W"
 		return result!
 	else:
-		return "Location not found: " + location!
+		return "Unknown location: " + location!
 
 String function cmd_model_list(location : String):
 	// List all models

+ 14 - 0
unit/test_all.py

@@ -2715,6 +2715,13 @@ class TestModelverse(unittest.TestCase):
         assert self.do_as_user("other_user", read_permissions, ["users/user/test/a"]) == ""
         assert self.do_as_user("admin", read_permissions, ["users/user/test/a"]) == "RW"
 
+        # Test for non-existing location
+        try:
+            read_permissions("adfadsf")
+            self.fail()
+        except UnknownLocation:
+            pass
+
     def test_op_read_permissions_folder(self):
         folder_create("users/user/test/a")
 
@@ -2740,6 +2747,13 @@ class TestModelverse(unittest.TestCase):
         assert self.do_as_user("other_user", read_permissions, ["users/user/test/a"]) == ""
         assert self.do_as_user("admin", read_permissions, ["users/user/test/a"]) == "RW"
 
+        # Test for non-existing location
+        try:
+            read_permissions("adfadsf")
+            self.fail()
+        except UnknownLocation:
+            pass
+
     """
     def test_op_model_render(self):
     def test_op_transformation_between(self):