def test_is_valid1(self): """Tests that the pre-made project information dictionary is valid according to project version 1.""" project_config_file = os.path.abspath( os.path.join(os.curdir, "tests", "test_resources", "Project Directory", ".spinetoolbox", "project.json")) project_upgrader = ProjectUpgrader(self.toolbox) project_dict = project_upgrader.open_proj_json(project_config_file) retval = project_upgrader.is_valid(project_dict) self.assertTrue(retval)
def test_upgrade(self): """Tests that reading an old project file (.proj) and upgrading it produces a valid project information dictionary.""" old_project_file = os.path.abspath( os.path.join(os.curdir, "tests", "test_resources", "unit_test_project.proj")) pu = ProjectUpgrader(self.toolbox) old_project_dict = pu.open_proj_json(old_project_file) with TemporaryDirectory() as old_project_dir: # Old project has four items which should have a data_dir a_dir = os.path.join(old_project_dir, "a") b_dir = os.path.join(old_project_dir, "b") c_dir = os.path.join(old_project_dir, "c") d_dir = os.path.join(old_project_dir, "d") create_dir(a_dir) create_dir(b_dir) create_dir(c_dir) create_dir(d_dir) udgraded_project_dict = pu.upgrade(old_project_dict, old_project_dir, "dummy_project_dir") retval = pu.is_valid(udgraded_project_dict) self.assertTrue(retval)