Move project name to project data class

This commit is contained in:
Veronica Berglyd Olsen
2022-10-30 23:18:18 +01:00
parent ea80fd3c71
commit e887ec6991
13 changed files with 174 additions and 73 deletions
+8 -8
View File
@@ -202,7 +202,7 @@ def testCoreProject_NewSampleA(fncDir, tmpConf, mockGUI, tmpDir):
assert theProject.newProject(projData) is True
assert theProject.openProject(fncDir) is True
assert theProject.projName == "Sample Project"
assert theProject.data.name == "Sample Project"
assert theProject.saveProject() is True
assert theProject.closeProject() is True
os.unlink(dstSample)
@@ -236,7 +236,7 @@ def testCoreProject_NewSampleB(monkeypatch, fncDir, tmpConf, mockGUI, tmpDir):
monkeypatch.setattr(nwFiles, "PROJ_FILE", "nwProject.nwx")
assert theProject.newProject(projData) is True
assert theProject.openProject(fncDir) is True
assert theProject.projName == "Sample Project"
assert theProject.data.name == "Sample Project"
assert theProject.saveProject() is True
assert theProject.closeProject() is True
@@ -895,8 +895,8 @@ def testCoreProject_Methods(monkeypatch, mockGUI, tmpDir, fncDir, mockRnd):
assert theProject.setProjectPath(fncDir)
# Project Name
assert theProject.setProjectName(" A Name ")
assert theProject.projName == "A Name"
assert theProject.data.setName(" A Name ")
assert theProject.data.name == "A Name"
# Project Title
assert theProject.setBookTitle(" A Title ")
@@ -944,9 +944,9 @@ def testCoreProject_Methods(monkeypatch, mockGUI, tmpDir, fncDir, mockRnd):
theProject.mainConf.backupPath = tmpDir
assert theProject.setProjBackup(True)
assert theProject.setProjectName("")
assert theProject.data.setName("")
assert not theProject.setProjBackup(True)
assert theProject.setProjectName("A Name")
assert theProject.data.setName("A Name")
assert theProject.setProjBackup(True)
# Spell check
@@ -1327,12 +1327,12 @@ def testCoreProject_Backup(monkeypatch, mockGUI, nwMinimal, tmpDir):
# Missing project name
theProject.mainConf.backupPath = tmpDir
theProject.projName = ""
theProject.data.name = ""
assert theProject.zipIt(doNotify=False) is False
# Non-existent folder
theProject.mainConf.backupPath = os.path.join(tmpDir, "nonexistent")
theProject.projName = "Test Minimal"
theProject.data.name = "Test Minimal"
assert theProject.zipIt(doNotify=False) is False
# Same folder as project (causes infinite loop in zipping)
+1 -1
View File
@@ -136,7 +136,7 @@ def testDlgProjSettings_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj, mockRnd
assert projSettings.spellChanged is False
projSettings._doSave()
assert theProject.projName == "Project Name"
assert theProject.data.name == "Project Name"
assert theProject.bookTitle == "Project Title"
assert theProject.bookAuthors == ["Jane Doe", "John Doh"]
+2 -2
View File
@@ -172,7 +172,7 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir, mock
assert nwGUI.theProject.tree.trashRoot() is None
assert nwGUI.theProject.projPath is None
assert nwGUI.theProject.projMeta is None
assert nwGUI.theProject.projName == ""
assert nwGUI.theProject.data.name == ""
assert nwGUI.theProject.bookTitle == ""
assert len(nwGUI.theProject.bookAuthors) == 0
assert not nwGUI.theProject.spellCheck
@@ -194,7 +194,7 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir, mock
assert nwGUI.theProject.tree.trashRoot() is None
assert nwGUI.theProject.projPath == fncProj
assert nwGUI.theProject.projMeta == os.path.join(fncProj, "meta")
assert nwGUI.theProject.projName == "New Project"
assert nwGUI.theProject.data.name == "New Project"
assert nwGUI.theProject.bookTitle == "New Novel"
assert len(nwGUI.theProject.bookAuthors) == 1
assert nwGUI.theProject.spellCheck is False
+1 -1
View File
@@ -167,7 +167,7 @@ def buildTestProject(theObject, projPath):
theProject.clearProject()
theProject.setProjectPath(projPath, newProject=True)
theProject.setProjectName("New Project")
theProject.data.setName("New Project")
theProject.setBookTitle("New Novel")
theProject.setBookAuthors("Jane Doe")