Browse Source

Added simple test for empty model construct

Yentl Van Tendeloo 8 years ago
parent
commit
e40982cddd
2 changed files with 59 additions and 0 deletions
  1. 6 0
      core/core_algorithm.alc
  2. 53 0
      integration/test_mvc.py

+ 6 - 0
core/core_algorithm.alc

@@ -22,6 +22,7 @@ Void function main():
 	String scd_model
 	String admin_group
 	String admin_user
+	String nobody_group
 
 	scd_location = "models/SimpleClassDiagrams"
 	core_location = "models/CoreFormalism"
@@ -35,6 +36,10 @@ Void function main():
 	admin_group = instantiate_node(core, "Group", "")
 	instantiate_attribute(core, admin_group, "name", "admin")
 
+	// Create nobody group
+	nobody_group = instantiate_node(core, "Group", "")
+	instantiate_attribute(core, nobody_group, "name", "nobody")
+
 	// Create admin user
 	admin_user = instantiate_node(core, "User", "")
 	output("Desired username for admin user?")
@@ -260,6 +265,7 @@ Void function model_create(model : Element, name : String, user_id : String, typ
 	instantiate_attribute(core, model_id, "location", location)
 	instantiate_attribute(core, model_id, "permissions", "200")
 	instantiate_link(core, "owner", "", model_id, user_id)
+	instantiate_link(core, "group", "", model_id, get_group_id("nobody"))
 	instantiate_link(core, "instanceOf", "", model_id, type_id)
 
 	return!

+ 53 - 0
integration/test_mvc.py

@@ -38,3 +38,56 @@ class TestModelverseCore(unittest.TestCase):
                      "  core : CoreFormalism"]),
             ],
             mode))
+
+    def test_po_list_full(self):
+        self.list_full("PO")
+
+    def list_full(self, mode):
+        self.assertTrue(run_file(all_files,
+            [ "root",
+                "model_list_full",
+            ],
+            [   "Desired username for admin user?",
+                "Welcome to the Model Management Interface v2.0!",
+                "Use the 'help' command for a list of possible commands",
+                "Ready for command...",
+                set(["  221  root admin    673   SimpleClassDiagrams : SimpleClassDiagrams",
+                     "  221  root admin    86   CoreFormalism : SimpleClassDiagrams",
+                     "  200  root admin    43   core : CoreFormalism"]),
+            ],
+            mode))
+
+    def test_po_model_add_empty(self):
+        self.model_add_empty("PO")
+
+    def model_add_empty(self, mode):
+        self.assertTrue(run_file(all_files,
+            [ "root",
+                "model_add",
+                "SimpleClassDiagrams",
+                "Empty",
+                "exit",
+                "model_list",
+                "model_list_full",
+            ],
+            [   "Desired username for admin user?",
+                "Welcome to the Model Management Interface v2.0!",
+                "Use the 'help' command for a list of possible commands",
+                "Ready for command...",
+                "Creating new model!",
+                "Model type?",
+                "Model name?",
+                "Waiting for model constructors...",
+                "Model upload success!",
+                "Ready for command...",
+                set(["  SimpleClassDiagrams : SimpleClassDiagrams",
+                     "  CoreFormalism : SimpleClassDiagrams",
+                     "  Empty : SimpleClassDiagrams",
+                     "  core : CoreFormalism"]),
+                "Ready for command...",
+                set(["  221  root admin    673   SimpleClassDiagrams : SimpleClassDiagrams",
+                     "  221  root admin    86   CoreFormalism : SimpleClassDiagrams",
+                     "  200  root nobody    0   Empty : SimpleClassDiagrams",
+                     "  200  root admin    53   core : CoreFormalism"]),
+            ],
+            mode))