Beispiel #1
0
    def test_restore_last_project(self):
        """Restore last used project."""

        manager = project.ProjectManager(self.mktemp())
        prj = manager.get_project(NAME)
        prj.create()
        settings = Settings(self.mktemp())
        settings.set("current_project", NAME)
        self.assertEqual(manager.restore_last(Factory(), settings), prj)
Beispiel #2
0
    def test_restore_last_project_not_exists(self):
        """
        If the last project does not exists, don't create a new one with the
        same name but use a default name.
        """

        settings = Settings(self.mktemp())
        settings.set("current_project", NAME)
        manager = project.ProjectManager(self.mktemp())
        prj = manager.get_project(NAME)
        self.assertFalse(prj.exists())
        prj = manager.restore_last(Factory(), settings)
        self.assertEqual(prj.name, settings.DEFAULT_PROJECT + "_0")