瀏覽代碼

Updated the first powerwindow test to use wrappers

Yentl Van Tendeloo 8 年之前
父節點
當前提交
5d2823e675
共有 2 個文件被更改,包括 138 次插入446 次删除
  1. 130 444
      integration/test_powerwindow.py
  2. 8 2
      wrappers/modelverse.py

+ 130 - 444
integration/test_powerwindow.py

@@ -1,455 +1,141 @@
 import unittest
 
 from utils import *
+import sys
 
-model_list = set(["  SimpleClassDiagrams : SimpleClassDiagrams",
-                  "  CoreFormalism : SimpleClassDiagrams",
-                  "  ManualOperation : SimpleClassDiagrams",
-                  "  ActionLanguage : SimpleClassDiagrams",
-                  "  ProcessModel : SimpleClassDiagrams",
-                  "  Tracability : SimpleClassDiagrams",
-                  "  core : CoreFormalism"])
+sys.path.append("wrappers")
+from modelverse import *
 
-model_full_list = set(["  221  root admin   SimpleClassDiagrams : SimpleClassDiagrams",
-                       "  221  root admin   CoreFormalism : SimpleClassDiagrams",
-                       "  221  root admin   ActionLanguage : SimpleClassDiagrams",
-                       "  221  root admin   ManualOperation : SimpleClassDiagrams",
-                       "  221  root admin   ProcessModel : SimpleClassDiagrams",
-                       "  221  root admin   Tracability : SimpleClassDiagrams",
-                       "  200  root admin   core : CoreFormalism"])
+class TestPowerWindow(unittest.TestCase):
+    def setUp(self):
+        self.proc, self.address = start_mvc()
+        init(self.address)
+        login("admin", "admin")
 
-all_files = [   "core/mini_modify.alc",
-                "core/core_formalism.mvc",
-                "core/core_algorithm.alc",
-                "core/pm.mvc",
-                "primitives.alc",
-                "object_operations.alc",
-                "conformance_scd.alc",
-                "library.alc",
-                "transform.alc",
-                "model_management.alc",
-                "ramify.alc",
-                "metamodels.alc",
-                "random.alc",
-                "constructors.alc",
-                "modelling.alc",
-                "compilation_manager.alc",
-            ]
+    def tearDown(self):
+        kill(self.proc)
 
-class TestPowerWindow(unittest.TestCase):
     def test_process_powerwindow_fast(self):
-        self.assertTrue(run_file(all_files,
-            [ "root", "root", "root", 
-                "model_add",
-                    "SimpleClassDiagrams",
-                    "ReachabilityGraph",
-                    ] + get_model_constructor_2("models/reachability_graph.mvc") + [
-                "model_add",
-                    "SimpleClassDiagrams",
-                    "PetriNet",
-                    ] + get_model_constructor_2("integration/code/pn_design.mvc") + [
-                "model_add",
-                    "SimpleClassDiagrams",
-                    "Encapsulated_PetriNet",
-                    ] + get_model_constructor_2("models/petrinet_ports.mvc") + [
-                "model_add",
-                    "SimpleClassDiagrams",
-                    "PW_Plant",
-                    ] + get_model_constructor_2("models/plant_PW.mvc") + [
-                "model_add",
-                    "SimpleClassDiagrams",
-                    "PW_Environment",
-                    ] + get_model_constructor_2("models/environment_PW.mvc") + [
-                "model_add",
-                    "SimpleClassDiagrams",
-                    "PW_Control",
-                    ] + get_model_constructor_2("models/control_PW.mvc") + [
-                "model_add",
-                    "SimpleClassDiagrams",
-                    "Requirements",
-                    ] + get_model_constructor_2("models/requirements.mvc") + [
-                "model_add",
-                    "SimpleClassDiagrams",
-                    "Query",
-                    ] + get_model_constructor_2("models/query.mvc") + [
-                "model_add",
-                    "ProcessModel",
-                    "pm_powerwindow",
-                    ] + get_model_constructor_2("models/pm_req_analyse.mvc") + [
-                "model_add",
-                    "SimpleClassDiagrams",
-                    "Architecture",
-                    ] + get_model_constructor_2("models/architecture.mvc") + [
-                "model_list",
-                "transformation_add_MT_language",
-                "PetriNet",
-                "Encapsulated_PetriNet",
-                "PW_Plant",
-                "PW_Control",
-                "PW_Environment",
-                "Requirements",
-                "ReachabilityGraph",
-                "Query",
-                "Architecture",
-                "",
-                "All_RAM",
-                "model_modify",
-                    "__merged_All_RAM",
-                        "instantiate",
-                            "Association",
-                            "CTRL2EPN_link",
-                            "PW_Control/State",
-                            "Encapsulated_PetriNet/Place",
-                        "instantiate",
-                            "Association",
-                            "CTRL2EPN_tlink",
-                            "PW_Control/Transition",
-                            "Encapsulated_PetriNet/Transition",
-                        "instantiate",
-                            "Association",
-                            "PLANT2EPN_link",
-                            "PW_Plant/State",
-                            "Encapsulated_PetriNet/Place",
-                        "instantiate",
-                            "Association",
-                            "PLANT2EPN_tlink",
-                            "PW_Plant/Transition",
-                            "Encapsulated_PetriNet/Transition",
-                        "instantiate",
-                            "Association",
-                            "ENV2EPN_link",
-                            "PW_Environment/Event",
-                            "Encapsulated_PetriNet/Place",
-                        "instantiate",
-                            "Association",
-                            "EPN2PN_place_link",
-                            "Encapsulated_PetriNet/Place",
-                            "PetriNet/Place",
-                        "instantiate",
-                            "Association",
-                            "EPN2PN_transition_link",
-                            "Encapsulated_PetriNet/Transition",
-                            "PetriNet/Transition",
-                        "exit",
-                "transformation_RAMify",
-                    "__merged_All_RAM",
-                    "All_RAM",
-                "transformation_add_MANUAL",
-                    "Requirements",
-                    "",
-                    "Requirements",
-                    "",
-                    "revise_req",
-                "transformation_add_MANUAL",
-                    "Requirements",
-                    "PW_Environment",
-                    "",
-                    "PW_Environment",
-                    "",
-                    "revise_environment",
-                "transformation_add_MANUAL",
-                    "Requirements",
-                    "PW_Plant",
-                    "",
-                    "PW_Plant",
-                    "",
-                    "revise_plant",
-                "transformation_add_MANUAL",
-                    "Requirements",
-                    "PW_Control",
-                    "",
-                    "PW_Control",
-                    "",
-                    "revise_control",
-                "transformation_add_MANUAL",
-                    "Requirements",
-                    "Query",
-                    "",
-                    "Query",
-                    "",
-                    "revise_query",
-                "transformation_add_MANUAL",
-                    "Requirements",
-                    "Architecture",
-                    "",
-                    "Architecture",
-                    "",
-                    "revise_architecture",
-                "transformation_add_MT",
-                    "All_RAM",
-                    "",
-                    "PW_Plant",
-                    "PW_Environment",
-                    "PW_Control",
-                    "Query",
-                    "Architecture",
-                    "Requirements",
-                    "",
-                    "make_initial_models",
-                    ] + get_model_constructor_2("models/initialize.mvc") + [
-                "transformation_add_MT",
-                    "All_RAM",
-                    "PW_Plant",
-                    "",
-                    "Encapsulated_PetriNet",
-                    "",
-                    "plant_to_EPN",
-                    ] + get_model_constructor_2("models/plant_to_EPN.mvc") + [
-                "transformation_add_MT",
-                    "All_RAM",
-                    "PW_Control",
-                    "",
-                    "Encapsulated_PetriNet",
-                    "",
-                    "control_to_EPN",
-                    ] + get_model_constructor_2("models/control_to_EPN.mvc") + [
-                "transformation_add_MT",
-                    "All_RAM",
-                    "PW_Environment",
-                    "",
-                    "Encapsulated_PetriNet",
-                    "",
-                    "environment_to_EPN",
-                    ] + get_model_constructor_2("models/environment_to_EPN.mvc") + [
-                "transformation_add_MT",
-                    "All_RAM",
-                    "Encapsulated_PetriNet",
-                    "Architecture",
-                    "",
-                    "Encapsulated_PetriNet",
-                    "",
-                    "combine_EPN",
-                    ] + get_model_constructor_2("models/combine_EPN.mvc") + [
-                "transformation_add_MT",
-                    "All_RAM",
-                    "ReachabilityGraph",
-                    "Query",
-                    "",
-                    "",
-                    "match",
-                    ] + get_model_constructor_2("models/matches.mvc") + [
-                "transformation_add_AL",
-                    "PetriNet",
-                    "",
-                    "ReachabilityGraph",
-                    "",
-                    "reachability",
-                    ] + get_constructor(open("models/reachability.alc", "r").read()) + [
-                "transformation_add_AL",
-                    "ReachabilityGraph",
-                    "",
-                    "",
-                    "bfs",
-                    ] + get_constructor(open("models/bfs.alc", "r").read()) + [
-                "model_list",
-                "process_execute",
-                "pm_powerwindow",
-                "pm_",
-                # revise_req
-                "upload",
-                ] + get_model_constructor_2("models/requirements_model.mvc") + [
-                "exit",
-                # revise_plant
-                "upload",
-                ] + get_model_constructor_2("models/plant_model.mvc") + [
-                "exit",
-                # revise_environment
-                "upload",
-                ] + get_model_constructor_2("models/environment_model.mvc") + [
-                "exit",
-                # revise_control
-                "upload",
-                ] + get_model_constructor_2("models/control_model.mvc") + [
-                "exit",
-                # revise_query
-                "upload",
-                ] + get_model_constructor_2("models/query_model.mvc") + [
-                "exit",
-                # revise_architecture
-                "upload",
-                ] + get_model_constructor_2("models/architecture_model.mvc") + [
-                "exit",
-            ],
-            [   # bootup phase
-                "Desired username for admin user?",
-                "Desired password for admin user?",
-                "Please repeat the password",
-                "Passwords match!",
-                "Welcome to the Model Management Interface v2.0!",
-                "Use the 'help' command for a list of possible commands",
-                "Ready for command...",
-                # model_add * 10
-                ] + [   "Creating new model!",
-                        "Model type?",
-                        "Model name?",
-                        "Waiting for model constructors...",
-                        "Model upload success!",
-                        "Ready for command...", ] * 10 + [
-                # model_list
-                model_list |
-                set([
-                     "  ReachabilityGraph : SimpleClassDiagrams",
-                     "  PetriNet : SimpleClassDiagrams",
-                     "  Encapsulated_PetriNet : SimpleClassDiagrams",
-                     "  PW_Plant : SimpleClassDiagrams",
-                     "  PW_Environment : SimpleClassDiagrams",
-                     "  PW_Control : SimpleClassDiagrams",
-                     "  Requirements : SimpleClassDiagrams",
-                     "  Query : SimpleClassDiagrams",
-                     "  pm_powerwindow : ProcessModel",
-                     "  Architecture : SimpleClassDiagrams",
-                     ]),
-                "Ready for command...",
-                # transformation_add_MT_language
-                "Formalisms to include (terminate with empty string)?",
-                "Name of the RAMified transformation metamodel?",
-                "Ready for command...",
-                # model_modify
-                "Which model do you want to modify?",
-                "Model loaded, ready for commands!",
-                "Mode: r/w",
-                "Use 'help' command for a list of possible commands",
-                "Please give your command.",
-                # instantiate * 7
-                ] + [   "Type to instantiate?",
-                        "Name of new element?",
-                        "Source name?",
-                        "Destination name?",
-                        "Instantiation successful!",
-                        None,
-                        "Please give your command.", ] * 7 + [
-                "Ready for command...",
-                # transformation_RAMify
-                "Which metamodel do you want to RAMify?",
-                "Where do you want to store the RAMified metamodel?",
-                "Ready for command...",
-                # transformation_add_MANUAL * 6
-                ] + [
-                    "Which metamodels do you want to use as source for the operation (empty string to finish)?",
-                    "Which metamodels do you want to use as target for the operation (empty string to finish)?",
-                    "Name of operation model?",
-                    "Ready for command...",
-                    ] * 6 + [
-                # transformation_add_MT * 6
-                ] + [
-                    "RAMified metamodel to use?",
-                    "Supported metamodels:",
-                    set(["  PetriNet",
-                         "  Encapsulated_PetriNet",
-                         "  PW_Plant",
-                         "  Architecture",
-                         "  Query",
-                         "  PW_Environment",
-                         "  Requirements",
-                         "  PW_Control",
-                         "  ReachabilityGraph",
-                        ]),
-                    "Which metamodels do you want to use as source for the operation (empty string to finish)?",
-                    "Which metamodels do you want to use as target for the operation (empty string to finish)?",
-                    "Name of new operation?",
-                    "Waiting for model constructors...",
-                    "Ready for command...",
-                    ] * 6 + [
-                # transformation_add_AL * 2
-                ] + [   "Which metamodels do you want to use as source for the operation (empty string to finish)?",
-                        "Which metamodels do you want to use as target for the operation (empty string to finish)?",
-                        "Name of operation model?",
-                        "Waiting for model constructors...",
-                        "Ready for command...", ] * 2 + [
-                # model_list
-                model_list |
-                set([
-                     "  PetriNet : SimpleClassDiagrams",
-                     "  Encapsulated_PetriNet : SimpleClassDiagrams",
-                     "  PW_Plant : SimpleClassDiagrams",
-                     "  PW_Environment : SimpleClassDiagrams",
-                     "  PW_Control : SimpleClassDiagrams",
-                     "  Requirements : SimpleClassDiagrams",
-                     "  Query : SimpleClassDiagrams",
-                     "  reachability : ActionLanguage",
-                     "  revise_req : ManualOperation",
-                     "  revise_plant : ManualOperation",
-                     "  revise_control : ManualOperation",
-                     "  revise_environment : ManualOperation",
-                     "  revise_query : ManualOperation",
-                     "  revise_architecture : ManualOperation",
-                     "  __merged_bfs : SimpleClassDiagrams",
-                     "  __merged_reachability : SimpleClassDiagrams",
-                     "  __merged_revise_req : SimpleClassDiagrams",
-                     "  __merged_All_RAM : SimpleClassDiagrams",
-                     "  __merged_revise_plant : SimpleClassDiagrams",
-                     "  __merged_revise_control : SimpleClassDiagrams",
-                     "  __merged_revise_environment : SimpleClassDiagrams",
-                     "  __merged_revise_query : SimpleClassDiagrams",
-                     "  __merged_revise_architecture : SimpleClassDiagrams",
-                     "  match : All_RAM",
-                     "  All_RAM : SimpleClassDiagrams",
-                     "  make_initial_models : All_RAM",
-                     "  pm_powerwindow : ProcessModel",
-                     "  plant_to_EPN : All_RAM",
-                     "  combine_EPN : All_RAM",
-                     "  environment_to_EPN : All_RAM",
-                     "  control_to_EPN : All_RAM",
-                     "  ReachabilityGraph : SimpleClassDiagrams",
-                     "  Architecture : SimpleClassDiagrams",
-                     "  bfs : ActionLanguage",
-                     ]),
-                "Ready for command...",
-                # process_execute
-                "Which process model do you want to execute?",
-                "Model prefix to use?",
-                # Manual transformation revise_req
-                "Please perform manual operation \"revise_req\"",
-                "Model loaded, ready for commands!",
-                "Mode: r/w",
-                "Use 'help' command for a list of possible commands",
-                "Please give your command.",
-                "Waiting for model constructors...",
-                "Please give your command.",
-                # Manual transformation revise_plant
-                "Please perform manual operation \"revise_plant\"",
-                "Model loaded, ready for commands!",
-                "Mode: r/w",
-                "Use 'help' command for a list of possible commands",
-                "Please give your command.",
-                "Waiting for model constructors...",
-                "Please give your command.",
-                # Manual transformation revise_environment
-                "Please perform manual operation \"revise_environment\"",
-                "Model loaded, ready for commands!",
-                "Mode: r/w",
-                "Use 'help' command for a list of possible commands",
-                "Please give your command.",
-                "Waiting for model constructors...",
-                "Please give your command.",
-                # Manual transformation revise_control
-                "Please perform manual operation \"revise_control\"",
-                "Model loaded, ready for commands!",
-                "Mode: r/w",
-                "Use 'help' command for a list of possible commands",
-                "Please give your command.",
-                "Waiting for model constructors...",
-                "Please give your command.",
-                # Manual transformation revise_query
-                "Please perform manual operation \"revise_query\"",
-                "Model loaded, ready for commands!",
-                "Mode: r/w",
-                "Use 'help' command for a list of possible commands",
-                "Please give your command.",
-                "Waiting for model constructors...",
-                "Please give your command.",
-                # Manual transformation revise_architecture
-                "Please perform manual operation \"revise_architecture\"",
-                "Model loaded, ready for commands!",
-                "Mode: r/w",
-                "Use 'help' command for a list of possible commands",
-                "Please give your command.",
-                "Waiting for model constructors...",
-                "Please give your command.",
-                # Computations happen without output
-                # Finished, so we go back to the start
-                "Ready for command...",
-            ]))
+        model_add("ReachabilityGraph", "SimpleClassDiagrams", open("models/reachability_graph.mvc", "r").read())
+        model_add("PetriNet", "SimpleClassDiagrams", open("integration/code/pn_design.mvc", 'r').read())
+        model_add("Encapsulated_PetriNet", "SimpleClassDiagrams", open("models/petrinet_ports.mvc", 'r').read())
+
+        model_add("PW_Plant", "SimpleClassDiagrams", open("models/plant_PW.mvc", 'r').read())
+        model_add("PW_Environment", "SimpleClassDiagrams", open("models/environment_PW.mvc", 'r').read())
+        model_add("PW_Control", "SimpleClassDiagrams", open("models/control_PW.mvc", 'r').read())
+        model_add("Requirements", "SimpleClassDiagrams", open("models/requirements.mvc", 'r').read())
+        model_add("Query", "SimpleClassDiagrams", open("models/query.mvc", 'r').read())
+        model_add("Architecture", "SimpleClassDiagrams", open("models/architecture.mvc", 'r').read())
+
+        model_add("pm_powerwindow", "ProcessModel", open("models/pm_req_analyse.mvc", 'r').read())
+
+        assert model_list() == set([\
+                ("ReachabilityGraph", "SimpleClassDiagrams"),
+                ("PetriNet", "SimpleClassDiagrams"),
+                ("Encapsulated_PetriNet", "SimpleClassDiagrams"),
+                ("PW_Plant", "SimpleClassDiagrams"),
+                ("PW_Environment", "SimpleClassDiagrams"),
+                ("PW_Control", "SimpleClassDiagrams"),
+                ("Requirements", "SimpleClassDiagrams"),
+                ("Query", "SimpleClassDiagrams"),
+                ("Architecture", "SimpleClassDiagrams"),
+                ("pm_powerwindow", "ProcessModel"),
+                ("SimpleClassDiagrams", "SimpleClassDiagrams"),
+                ("CoreFormalism", "SimpleClassDiagrams"),
+                ("ManualOperation", "SimpleClassDiagrams"),
+                ("ActionLanguage", "SimpleClassDiagrams"),
+                ("ProcessModel", "SimpleClassDiagrams"),
+                ("Tracability", "SimpleClassDiagrams"),
+                ("core", "CoreFormalism"),])
+
+        transformation_add_MT_language(["PetriNet", "Encapsulated_PetriNet", "PW_Plant", "PW_Control", "PW_Environment", "Requirements", "ReachabilityGraph", "Query", "Architecture"], "All_RAM")
+        instantiate("__merged_All_RAM", "Association", ("PW_Control/State", "Encapsulated_PetriNet/Place"), ID="CTRL2EPN_link")
+        instantiate("__merged_All_RAM", "Association", ("PW_Control/Transition", "Encapsulated_PetriNet/Transition"), ID="CTRL2EPN_tlink")
+        instantiate("__merged_All_RAM", "Association", ("PW_Plant/State", "Encapsulated_PetriNet/Place"), ID="PLANT2EPN_link")
+        instantiate("__merged_All_RAM", "Association", ("PW_Plant/Transition", "Encapsulated_PetriNet/Transition"), ID="PLANT2EPN_tlink")
+        instantiate("__merged_All_RAM", "Association", ("PW_Environment/Event", "Encapsulated_PetriNet/Place"), ID="ENV2EPN_link")
+        instantiate("__merged_All_RAM", "Association", ("Encapsulated_PetriNet/Place", "PetriNet/Place"), ID="EPN2PN_transition_link")
+        instantiate("__merged_All_RAM", "Association", ("Encapsulated_PetriNet/Transition", "PetriNet/Transition"), ID="EPN2PN_place_link")
+        transformation_RAMify("__merged_All_RAM", "All_RAM")
+
+        transformation_add_MANUAL(["Requirements"], ["Requirements"], "revise_req")
+        transformation_add_MANUAL(["Requirements", "PW_Environment"], ["PW_Environment"], "revise_environment")
+        transformation_add_MANUAL(["Requirements", "PW_Plant"], ["PW_Plant"], "revise_plant")
+        transformation_add_MANUAL(["Requirements", "PW_Control"], ["PW_Control"], "revise_control")
+        transformation_add_MANUAL(["Requirements", "Query"], ["Query"], "revise_query")
+        transformation_add_MANUAL(["Requirements", "Architecture"], ["Architecture"], "revise_architecture")
+
+        transformation_add_MT("All_RAM", [], ["PW_Plant", "PW_Environment", "PW_Control", "Query", "Architecture", "Requirements"], "make_initial_models", open("models/initialize.mvc", 'r').read())
+        transformation_add_MT("All_RAM", ["PW_Plant"], ["Encapsulated_PetriNet"], "plant_to_EPN", open("models/plant_to_EPN.mvc", 'r').read())
+        transformation_add_MT("All_RAM", ["PW_Control"], ["Encapsulated_PetriNet"], "control_to_EPN", open("models/control_to_EPN.mvc", 'r').read())
+        transformation_add_MT("All_RAM", ["PW_Environment"], ["Encapsulated_PetriNet"], "environment_to_EPN", open("models/environment_to_EPN.mvc", 'r').read())
+        transformation_add_MT("All_RAM", ["Encapsulated_PetriNet", "Architecture"], ["Encapsulated_PetriNet"], "combine_EPN", open("models/combine_EPN.mvc", 'r').read())
+        transformation_add_MT("All_RAM", ["ReachabilityGraph", "Query"], [], "match", open("models/matches.mvc", 'r').read())
+
+        transformation_add_AL(["PetriNet"], ["ReachabilityGraph"], "reachability", open("models/reachability.alc", 'r').read())
+        transformation_add_AL(["ReachabilityGraph"], [], "bfs", open("models/bfs.alc", 'r').read())
+
+        global called
+        called = 0
+
+        def cb_req():
+            global called
+            if called > len(callbacks):
+                raise Exception("Seemingly called some operation twice!")
+            else:
+                called += 1
+            model_overwrite(None, open("models/requirements_model.mvc", 'r').read())
+
+        def cb_plant():
+            global called
+            if called > len(callbacks):
+                raise Exception("Seemingly called some operation twice!")
+            else:
+                called += 1
+            model_overwrite(None, open("models/plant_model.mvc", 'r').read())
+
+        def cb_env():
+            global called
+            if called > len(callbacks):
+                raise Exception("Seemingly called some operation twice!")
+            else:
+                called += 1
+            model_overwrite(None, open("models/environment_model.mvc", 'r').read())
+
+        def cb_ctrl():
+            global called
+            if called > len(callbacks):
+                raise Exception("Seemingly called some operation twice!")
+            else:
+                called += 1
+            model_overwrite(None, open("models/control_model.mvc", 'r').read())
+
+        def cb_query():
+            global called
+            if called > len(callbacks):
+                raise Exception("Seemingly called some operation twice!")
+            else:
+                called += 1
+            model_overwrite(None, open("models/query_model.mvc", 'r').read())
+
+        def cb_arch():
+            global called
+            if called > len(callbacks):
+                raise Exception("Seemingly called some operation twice!")
+            else:
+                called += 1
+            model_overwrite(None, open("models/architecture_model.mvc", 'r').read())
+
+        callbacks = {
+                "revise_req": cb_req,
+                "revise_plant": cb_plant,
+                "revise_environment": cb_env,
+                "revise_control": cb_ctrl,
+                "revise_query": cb_query,
+                "revise_architecture": cb_arch,
+            }
+
+        process_execute("pm_powerwindow", "pm_", callbacks)
 
     @slow
     def test_process_powerwindow_debug(self):

+ 8 - 2
wrappers/modelverse.py

@@ -343,7 +343,7 @@ def model_overwrite(model_name, new_model=None):
     # raises PermissionDenied
     # raises CompilationError
     # raises UnknownError
-    if mode != MODE_MODELLING:
+    if mode not in [MODE_MODELLING, MODE_MODIFY, MODE_MANUAL]:
         raise InvalidMode()
 
     if new_model is not None:
@@ -354,7 +354,13 @@ def model_overwrite(model_name, new_model=None):
     else:
         compiled = ["exit"]
 
-    _input(["model_overwrite", model_name])
+    if mode == MODE_MODELLING:
+        _input(["model_overwrite", model_name])
+    elif mode == MODE_MODIFY or mode == MODE_MANUAL:
+        _input("upload")
+    else:
+        raise InvalidMode()
+
     _handle_output("Waiting for model constructors...")
     _input(compiled)
     _output("Success")