Beispiel #1
0
 def testQuestionAtSameModule(self):
     (session, survey) = createSurvey()
     child = model.Risk(title="Risk 1", risk_id="1", zodb_path="1")
     survey.addChild(child)
     sister = model.Risk(title="Risk 2", risk_id="2", zodb_path="2")
     survey.addChild(sister)
     self.assertTrue(
         navigation.FindPreviousQuestion(sister, survey) is child)
Beispiel #2
0
 def testQuestionAtPreviousModule(self):
     (session, survey) = createSurvey()
     mod1 = model.Module(title="Module 1", module_id="1", zodb_path="1")
     survey.addChild(mod1)
     q1 = model.Risk(title="Risk 1", risk_id="1", zodb_path="1/1")
     mod1.addChild(q1)
     mod2 = model.Module(title="Module 2", module_id="2", zodb_path="2")
     survey.addChild(mod2)
     self.assertTrue(navigation.FindPreviousQuestion(mod2, survey) is q1)
Beispiel #3
0
 def testQuestionAtPreviousModuleWithSkippedChildren(self):
     (session, survey) = createSurvey()
     mod1 = model.Module(title=u"Module 1",
                         module_id="1",
                         zodb_path="1",
                         has_description=True,
                         skip_children=True)
     survey.addChild(mod1)
     q1 = model.Risk(title=u"Risk 1", risk_id="1", zodb_path="1/1")
     mod1.addChild(q1)
     mod2 = model.Module(title=u"Module 2", module_id="2", zodb_path="2")
     survey.addChild(mod2)
     self.failUnless(navigation.FindPreviousQuestion(mod2, survey) is mod1)
Beispiel #4
0
 def test_skip_module_without_description(self):
     (session, survey) = createSurvey()
     mod1 = model.Module(title="Module 1",
                         module_id="1",
                         zodb_path="1",
                         has_description=True)
     survey.addChild(mod1)
     q1 = model.Risk(title="Risk 1", risk_id="1", zodb_path="1/1")
     mod1.addChild(q1)
     mod2 = model.Module(title="Module 2",
                         module_id="2",
                         zodb_path="2",
                         has_description=False)
     survey.addChild(mod2)
     mod3 = model.Module(title="Module 3", module_id="3", zodb_path="3")
     survey.addChild(mod3)
     self.assertTrue(navigation.FindPreviousQuestion(mod3, survey) is q1)
Beispiel #5
0
 def testSingleQuestion(self):
     (session, survey) = createSurvey()
     child = model.Risk(title="Risk", risk_id="1", zodb_path="1")
     survey.addChild(child)
     self.assertTrue(navigation.FindPreviousQuestion(child, survey) is None)