Beispiel #1
0
    def test_can_dump_added_model(self):
        model_name = 'model'

        project = Project()
        saved = Model({'launcher': 'name'})
        project.add_model(model_name, saved)

        with TestDir() as test_dir:
            project.save(test_dir)

            loaded = Project.load(test_dir)
            loaded = loaded.get_model(model_name)
            self.assertEqual(saved, loaded)
Beispiel #2
0
 def add_model(self, name, value=None):
     if value is None or isinstance(value, (dict, Config)):
         value = Model(value)
     self.env.register_model(name, value)
     self.config.models[name] = value