예제 #1
0
    def testQuerying(self):
        (self.session, self.survey) = createSurvey()
        self.mod1 = model.Module(title=u"Module 1",
                                 module_id="1",
                                 zodb_path="1",
                                 skip_children=False)
        self.survey.addChild(self.mod1)
        self.q1 = model.Risk(title=u"Risk 1",
                             risk_id="1",
                             zodb_path="1/1",
                             type="risk",
                             identification="no")
        self.mod1.addChild(self.q1)
        self.assertEqual(self.query().count(), 2)

        self.q2 = model.Risk(title=u"Risk 2",
                             risk_id="2",
                             zodb_path="1/2",
                             type="risk",
                             identification="no",
                             is_custom_risk="true")
        self.mod1.addChild(self.q1)
        self.assertEqual(self.query().count(), 2)

        self.q2 = model.Risk(title=u"Risk 3",
                             risk_id="2",
                             zodb_path="1/3",
                             type="risk",
                             identification="no",
                             is_custom_risk="false")
        self.mod1.addChild(self.q1)
        self.assertEqual(self.query().count(), 2)
예제 #2
0
    def test_get_measures_order_by_priority(self):
        session = self.createSurveySession()
        module = model.Module(
            title=u'Root',
            module_id='1',
            zodb_path='1',
            skip_children=False)
        session.addChild(module)
        module.addChild(model.Risk(
            title=u'Risk 1', risk_id='2', zodb_path='1/2', type='risk',
            priority=u'low', identification='no',
            action_plans=[model.ActionPlan(
                action_plan=u"Do something awesome",
                planning_start=datetime.date(2013, 3, 4))]))
        module.addChild(model.Risk(
            title=u'Risk 2', risk_id='3', zodb_path='1/3', type='risk',
            priority=u'high', identification='no',
            action_plans=[model.ActionPlan(
                action_plan=u"Do something awesome",
                planning_start=datetime.date(2013, 5, 2))]))
        module.addChild(model.Risk(
            title=u'Risk 3', risk_id='4', zodb_path='1/4', type='risk',
            priority=u'medium', identification='no',
            action_plans=[model.ActionPlan(
                action_plan=u"Do something awesome",
                planning_start=datetime.date(2013, 4, 1))]))

        view = self.ActionPlanTimeline(None, None)
        view.session = self.session
        measures = view.get_measures()
        self.assertEqual(
            [risk.priority for (m, risk, measure) in measures],
            [u'high', u'medium', u'low'])
예제 #3
0
 def test_Question_at_same_level_as_module(self):
     (session, survey) = createSurvey()
     session.add(survey)
     child = model.Risk(title="Risk", risk_id="1", zodb_path="1")
     survey.addChild(child)
     sister = model.Risk(title="Risk", risk_id="2", zodb_path="2")
     survey.addChild(sister)
     self.assertTrue(navigation.FindNextQuestion(child, survey) is sister)
예제 #4
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)
예제 #5
0
 def testIgnoreSiblingQuestions(self):
     self.createSqlData()
     self.mod1.removeChildren()
     mod11 = self.mod1.addChild(
         model.Module(title="module 1.1", module_id="11", zodb_path="a/a"))
     q111 = mod11.addChild(
         model.Risk(title="question 1.1.1",
                    risk_id="111",
                    zodb_path="a/a/a"))
     self.mod1.addChild(
         model.Risk(title="question 1.2", risk_id="12", zodb_path="a/b"))
     data = navigation.getTreeData(self.request, q111, survey=self.survey)
     mod1_data = data["children"][0]
     self.assertEqual(len(mod1_data["children"]), 1)
     self.assertEqual(mod1_data["children"][0]["id"], mod11.id)
예제 #6
0
    def test_half_complete(self):
        self.mod1 = self.survey.addChild(
            model.Module(title="module 1", module_id="1", zodb_path="a"))
        self.q1 = self.mod1.addChild(
            model.Risk(title="question 1", risk_id="1", zodb_path="a/b"))
        self.q2 = self.mod1.addChild(
            model.Risk(title="question 2", risk_id="2", zodb_path="a/c"))
        self.session.flush()

        self.q1.postponed = False
        self.q1.identification = "no"

        with self._get_view("webhelpers", self.portal.client) as view:
            view.update_completion_percentage(self.survey)
        self.assertEqual(self.survey.completion_percentage, 50)
예제 #7
0
 def test_create_workbook_no_problem_description(self):
     dbsession = Session()
     session = self._create_session(dbsession)
     module = model.Module(
         zodb_path='1',
         path='001',
         title=u'Top-level Module title',
     )
     risk = model.Risk(zodb_path='1/2/3',
                       risk_id='1',
                       title=u'Risk title',
                       priority='high',
                       identification='no',
                       path='001002003',
                       comment=u'Risk comment')
     request = testRequest()
     request.survey = mock.Mock()
     request.survey.ProfileQuestions = lambda: []
     zodb_node = mock.Mock()
     zodb_node.title = u'Risk title.'
     zodb_node.problem_description = u'  '
     request.survey.restrictedTraverse.return_value = zodb_node
     setRequest(request)
     view = self.ActionPlanTimeline(None, request)
     view.session = session
     view.getRisks = lambda x: [(module, risk)]
     sheet = view.create_workbook().worksheets[0]
     self.assertEqual(sheet.cell('J2').value, u'Risk title')
예제 #8
0
 def testShowModuleWithTop5RiskEvenIfNotPresent(self):
     (session, survey) = createSurvey()
     mod1 = model.Module(title="Module 1",
                         module_id="1",
                         zodb_path="1",
                         skip_children=False)
     survey.addChild(mod1)
     mod11 = model.Module(
         title="Module 1.1",
         module_id="11",
         zodb_path="1/1",
         skip_children=False,
         has_description=True,
     )
     mod1.addChild(mod11)
     q111 = model.Risk(
         title="Risk 1.1.1",
         risk_id="1",
         zodb_path="1/1/1",
         identification="yes",
         risk_type="top5",
     )
     mod11.addChild(q111)
     self.assertTrue(
         navigation.FindNextQuestion(mod1, survey, self.filter()) is mod11)
예제 #9
0
 def test_get_measures_with_correct_module(self):
     dbsession = Session()
     session = self._create_session(dbsession)
     # This first module should be ignored, it doesn't contain any risks
     session.addChild(model.Module(
         zodb_path='1',
         module_id='1',
     ))
     # Between the next two modules, the first one (root-level) must be
     # returned.
     module = session.addChild(model.Module(
         zodb_path='2',
         module_id='2',
     ))
     module = module.addChild(model.Module(
         zodb_path='2/3',
         module_id='3',
     ))
     module.addChild(
         model.Risk(zodb_path='2/3/4', risk_id='1', identification='no'))
     request = testRequest()
     request.survey = mock.Mock()
     request.survey.restrictedTraverse = lambda x: object
     request.survey.ProfileQuestions = lambda: []
     view = self.ActionPlanTimeline(None, request)
     view.session = session
     measures = view.get_measures()
     self.assertEqual(len(measures), 1)
     self.assertEqual(measures[0][0].module_id, u'2')
예제 #10
0
 def test_create_workbook_no_problem_description(self):
     view = self._get_timeline()
     module = model.Module(
         zodb_path="1",
         path="001",
         title="Top-level Module title",
     )
     risk = model.Risk(
         zodb_path="1/2/3",
         risk_id="1",
         title="Risk title",
         priority="high",
         identification="no",
         path="001002003",
         comment="Risk comment",
     )
     survey = view.context.aq_parent
     survey.ProfileQuestions = lambda: []
     zodb_node = mock.Mock()
     zodb_node.title = "Risk title."
     zodb_node.problem_description = "  "
     survey.restrictedTraverse.return_value = zodb_node
     view.getRisks = lambda x: [(module, risk)]
     sheet = view.create_workbook().worksheets[0]
     self.assertEqual(sheet["I2"].value, "Risk title")
예제 #11
0
파일: module.py 프로젝트: euphorie/Euphorie
    def add_custom_risk(self):
        sql_risks = self.context.children()
        if sql_risks.count():
            counter_id = max([int(risk.path[-3:]) for risk in sql_risks.all()]) + 1
        else:
            counter_id = 1

        # Add a new risk
        risk = model.Risk(
            comment="",
            priority=None,
            risk_id=None,
            risk_type="risk",
            skip_evaluation=True,
            title="",
            identification=None,
            training_notes="",
            custom_description="",
        )
        risk.is_custom_risk = True
        risk.skip_children = False
        risk.postponed = False
        risk.has_description = None
        risk.zodb_path = "/".join(
            [self.context.zodb_path] + ["%d" % counter_id]
        )  # There's a constraint for unique zodb_path per session
        risk.profile_index = 0  # XXX: not sure what this is for
        self.context.addChild(risk)
예제 #12
0
    def test_get_measures_filter_on_session(self):
        view = self._get_timeline()
        sessions = [
            view.context.session,
            self._create_session(),
        ]
        for session in sessions:
            module = session.addChild(
                model.Module(
                    session=session,
                    zodb_path="1",
                    module_id="1",
                ))
            module.addChild(
                model.Risk(
                    session=session,
                    zodb_path="1/2",
                    risk_id="1",
                    identification="no",
                    action_plans=[
                        model.ActionPlan(action="Measure 1 for %s" %
                                         session.account.loginname)
                    ],
                ))

        survey = view.context.aq_parent
        survey.restrictedTraverse = lambda x: object
        survey.ProfileQuestions = lambda: []

        measures = view.get_measures()
        self.assertEqual(len(measures), 1)
        self.assertEqual(measures[0][2].action,
                         "Measure 1 for [email protected]")
예제 #13
0
    def test_get_measures_order_by_start_date(self):
        view = self._get_timeline()
        session = view.context.session
        module = session.addChild(
            model.Module(
                session=session,
                zodb_path="1",
                module_id="1",
            ))
        module.addChild(
            model.Risk(
                session=session,
                zodb_path="1/2",
                risk_id="1",
                identification="no",
                action_plans=[
                    model.ActionPlan(action="Plan 2",
                                     planning_start=datetime.date(
                                         2011, 12, 15)),
                    model.ActionPlan(action="Plan 1",
                                     planning_start=datetime.date(
                                         2011, 11, 15)),
                ],
            ))

        survey = view.context.aq_parent
        survey.restrictedTraverse = lambda x: object
        survey.ProfileQuestions = lambda: []

        measures = view.get_measures()
        self.assertEqual(len(measures), 2)
        self.assertEqual([row[2].action for row in measures],
                         ["Plan 1", "Plan 2"])
예제 #14
0
    def test_get_measures_order_by_start_date(self):
        dbsession = Session()
        session = self._create_session(dbsession)
        module = session.addChild(
            model.Module(
                session=session,
                zodb_path='1',
                module_id='1',
            ))
        module.addChild(
            model.Risk(session=session,
                       zodb_path='1/2',
                       risk_id='1',
                       identification='no',
                       action_plans=[
                           model.ActionPlan(action_plan=u'Plan 2',
                                            planning_start=datetime.date(
                                                2011, 12, 15)),
                           model.ActionPlan(action_plan=u'Plan 1',
                                            planning_start=datetime.date(
                                                2011, 11, 15))
                       ]))

        request = testRequest()
        request.survey = mock.Mock()
        request.survey.restrictedTraverse = lambda x: object
        request.survey.ProfileQuestions = lambda: []
        setRequest(request)
        view = self.ActionPlanTimeline(None, request)
        view.session = session
        measures = view.get_measures()
        self.assertEqual(len(measures), 2)
        self.assertEqual([row[2].action_plan for row in measures],
                         [u'Plan 1', u'Plan 2'])
예제 #15
0
    def test_get_measures_with_correct_module(self):
        view = self._get_timeline()
        session = view.context.session

        # This first module should be ignored, it doesn't contain any risks
        session.addChild(model.Module(
            zodb_path="1",
            module_id="1",
        ))
        # Between the next two modules, the first one (root-level) must be
        # returned.
        module = session.addChild(model.Module(
            zodb_path="2",
            module_id="2",
        ))
        module = module.addChild(model.Module(
            zodb_path="2/3",
            module_id="3",
        ))
        module.addChild(
            model.Risk(zodb_path="2/3/4", risk_id="1", identification="no"))
        survey = view.context.aq_parent
        survey.restrictedTraverse = lambda x: object
        survey.ProfileQuestions = lambda: []

        measures = view.get_measures()
        self.assertEqual(len(measures), 1)
        self.assertEqual(measures[0][0].module_id, "2")
예제 #16
0
    def test_optional_module(self):
        self.mod1 = self.survey.addChild(
            model.Module(title="module 1", module_id="1", zodb_path="a"))
        self.q1 = self.mod1.addChild(
            model.Risk(title="question 1", risk_id="1", zodb_path="a/b"))
        self.mod2 = self.survey.addChild(
            model.Module(title="module 2", module_id="2", zodb_path="k"))
        self.q2 = self.mod2.addChild(
            model.Risk(title="question 2", risk_id="2", zodb_path="k/c"))
        self.q1.postponed = False
        self.q1.identification = "yes"
        self.mod2.skip_children = True

        with self._get_view("webhelpers", self.portal.client) as view:
            view.update_completion_percentage(self.survey)
        self.assertEqual(self.survey.completion_percentage, 100)
예제 #17
0
    def setUp(self):
        super(TestCloningViews, self).setUp()
        self.loginAsPortalOwner()
        addSurvey(self.portal, BASIC_SURVEY)
        self.jane = addAccount("*****@*****.**", password="******")
        self.john = addAccount("*****@*****.**", password="******")

        group = model.Group(group_id="1")
        model.Session.add(group)

        self.jane.group = group
        self.john.group = group
        model.Session.flush()

        survey_session = model.SurveySession(
            title="Dummy session",
            created=datetime(2012, 4, 22, 23, 5, 12),
            modified=datetime(2012, 4, 23, 11, 50, 30),
            zodb_path="nl/ict/software-development",
            account=self.jane,
            group=group,
            company=model.Company(country="nl",
                                  employees="1-9",
                                  referer="other"),
        )
        module = survey_session.addChild(
            model.Module(title="module 1", module_id="1", zodb_path="a"))
        risk = module.addChild(
            model.Risk(title="question 1", risk_id="1", zodb_path="a/b"))
        model.ActionPlan(action_plan="This is the plan", risk=risk)
        model.Session.add(survey_session)
예제 #18
0
    def test_get_measures_filter_on_session(self):
        dbsession = Session()
        sessions = []
        for login in ['jane', 'john']:
            session = self._create_session(dbsession, loginname=login)
            module = session.addChild(
                model.Module(
                    session=session,
                    zodb_path='1',
                    module_id='1',
                ))
            module.addChild(
                model.Risk(session=session,
                           zodb_path='1/2',
                           risk_id='1',
                           identification='no',
                           action_plans=[
                               model.ActionPlan(
                                   action_plan=u'Measure 1 for %s' % login)
                           ]))
            sessions.append(session)

        request = testRequest()
        request.survey = mock.Mock()
        request.survey.restrictedTraverse = lambda x: object
        request.survey.ProfileQuestions = lambda: []
        setRequest(request)
        view = self.ActionPlanTimeline(None, request)
        view.session = sessions[0]
        measures = view.get_measures()
        self.assertEqual(len(measures), 1)
        self.assertEqual(measures[0][2].action_plan, 'Measure 1 for jane')
예제 #19
0
    def test_get_measures_with_profile_questions(self):
        """ Test for #7322 and #8850
        """
        session = self.createSurveySession()
        question = model.Module(
            depth=1,
            title=u'(Repeatable Module) Do you have multiple shops?',
            module_id='1',
            zodb_path='1',
            skip_children=False,
            profile_index=-1,
        )
        session.addChild(question)

        i = 0
        for module_title in [
            u'(Repeating instance) Somerset West',
            u'(Repeating instance) Stellenbosch']:

            answer = model.Module(
                depth=2,
                title=module_title,
                module_id='2',
                zodb_path='1',
                skip_children=False,
                profile_index=i,
            )
            question.addChild(answer)

            answer.addChild(
                model.Risk(
                    depth=3,
                    title=u'Hands are washed',
                    risk_id='1',
                    zodb_path='1/2',
                    type='risk',
                    priority=u'low',
                    identification='no',
                    action_plans=[
                        model.ActionPlan(
                        action_plan=u"Do something awesome",
                        planning_start=datetime.date(2013, 3, 4))
                    ]
                )
            )
            i += 1

        view = self.ActionPlanTimeline(None, None)
        view.session = self.session

        measures = view.get_measures()
        self.assertEqual(len(measures), 2)
        self.assertEqual(
            measures[0][0].title,
            u'(Repeating instance) Somerset West',
        )
        self.assertEqual(
            measures[1][0].title,
            u'(Repeating instance) Stellenbosch',
        )
예제 #20
0
    def test_get_measures_with_nested_modules(self):
        """ """
        session = self.createSurveySession()
        module = model.Module(
            depth=1,
            title="Root Module",
            module_id="1",
            zodb_path="1",
            skip_children=False,
            profile_index=0,
        )
        session.addChild(module)

        nested_module1 = model.Module(
            depth=2,
            title="Nested Module 1",
            module_id="2",
            zodb_path="1/1",
            skip_children=False,
            profile_index=1,
        )
        module.addChild(nested_module1)

        nested_module2 = model.Module(
            depth=3,
            title="Nested Module 2",
            module_id="3",
            zodb_path="1/1/1",
            skip_children=False,
            profile_index=2,
        )
        nested_module1.addChild(nested_module2)

        risk = model.Risk(
            depth=4,
            title="Floors are washed",
            risk_id="1",
            zodb_path="1/1/1/1",
            type="risk",
            priority="low",
            identification="no",
            action_plans=[
                model.ActionPlan(
                    action_plan="Do something awesome",
                    planning_start=datetime.date(2013, 3, 4),
                )
            ],
        )
        nested_module2.addChild(risk)

        view = self.ActionPlanTimeline(None, None)
        view.session = self.session
        measures = view.get_measures()
        self.assertEqual(len(measures), 1)
        self.assertEqual(
            measures[0][0].title,
            "Nested Module 2",
        )
예제 #21
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)
예제 #22
0
    def test_get_measures_with_nested_modules(self):
        """ """
        session = self.createSurveySession()
        module = model.Module(
            depth=1,
            title=u'Root Module',
            module_id='1',
            zodb_path='1',
            skip_children=False,
            profile_index=0,
        )
        session.addChild(module)

        nested_module1 = model.Module(
            depth=2,
            title=u'Nested Module 1',
            module_id='2',
            zodb_path='1/1',
            skip_children=False,
            profile_index=1,
        )
        module.addChild(nested_module1)

        nested_module2 = model.Module(
            depth=3,
            title=u'Nested Module 2',
            module_id='3',
            zodb_path='1/1/1',
            skip_children=False,
            profile_index=2,
        )
        nested_module1.addChild(nested_module2)

        risk = model.Risk(
            depth=4,
            title=u'Floors are washed',
            risk_id='1',
            zodb_path='1/1/1/1',
            type='risk',
            priority=u'low',
            identification='no',
            action_plans=[
                model.ActionPlan(
                action_plan=u"Do something awesome",
                planning_start=datetime.date(2013, 3, 4))
            ]
        )
        nested_module2.addChild(risk)

        view = self.ActionPlanTimeline(None, None)
        view.session = self.session
        measures = view.get_measures()
        self.assertEqual(len(measures), 1)
        self.assertEqual(
            measures[0][0].title,
            u'Nested Module 2',
        )
예제 #23
0
 def createSqlData(self):
     self.request = MockRequest()
     (self.session, self.survey) = createSurvey()
     self.survey.restrictedTraverse = lambda x: None
     self.request.survey = self.survey
     self.survey.absolute_url = lambda self=None: "http://nohost"
     self.session.flush()
     self.mod1 = self.survey.addChild(
         model.Module(title="module 1", module_id="1", zodb_path="a"))
     self.q1 = self.mod1.addChild(
         model.Risk(title="question 1", risk_id="1", zodb_path="a/b"))
     self.session.flush()
예제 #24
0
 def testQuestionIsNextModule(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/2")
     mod1.addChild(q1)
     mod2 = model.Module(title="Module 2",
                         module_id="2",
                         zodb_path="2",
                         has_description=True)
     survey.addChild(mod2)
     self.assertTrue(navigation.FindNextQuestion(q1, survey) is mod2)
예제 #25
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)
예제 #26
0
 def createData(self):
     (self.session, self.survey) = createSurvey()
     self.mod1 = model.Module(title=u"Module 1",
                              module_id="1",
                              zodb_path="1",
                              skip_children=False)
     self.survey.addChild(self.mod1)
     self.q1 = model.Risk(title=u"Risk 1",
                          risk_id="1",
                          zodb_path="1/1",
                          type="risk",
                          identification="no")
     self.mod1.addChild(self.q1)
예제 #27
0
 def test_create_workbook_plan_information(self):
     dbsession = Session()
     session = self._create_session(dbsession)
     module = model.Module(
         zodb_path='1',
         title=u'Top-level Module title',
     )
     risk = model.Risk(zodb_path='1/2/3',
                       risk_id='1',
                       title=u'Risk title',
                       priority='high',
                       identification='no',
                       path='001002003',
                       comment=u'Risk comment')
     plan = model.ActionPlan(action_plan=u'Plan 2',
                             planning_start=datetime.date(2011, 12, 15),
                             budget=500)
     request = testRequest()
     request.survey = mock.Mock()
     zodb_node = mock.Mock()
     zodb_node.problem_description = u'This is wrong.'
     request.survey.restrictedTraverse.return_value = zodb_node
     view = self.ActionPlanTimeline(None, request)
     view.session = session
     view.get_measures = lambda: [(module, risk, plan)]
     sheet = view.create_workbook().worksheets[0]
     # planning start
     self.assertEqual(
         sheet.cell('A2').value.date(), datetime.date(2011, 12, 15))
     # planning end
     self.assertEqual(sheet.cell('B2').value, None)
     # action plan
     self.assertEqual(sheet.cell('C2').value, u'Plan 2')
     # prevention plan
     self.assertEqual(sheet.cell('D2').value, None)
     # requirements
     self.assertEqual(sheet.cell('E2').value, None)
     # responsible
     self.assertEqual(sheet.cell('F2').value, None)
     # budget
     self.assertEqual(sheet.cell('G2').value, 500)
     # module title
     self.assertEqual(sheet.cell('H2').value, u'Top-level Module title')
     # risk number
     self.assertEqual(sheet.cell('I2').value, u'1.2.3')
     # risk title
     self.assertEqual(sheet.cell('J2').value, u'This is wrong.')
     # risk priority
     self.assertEqual(sheet.cell('K2').value, u'High')
     # risk comment
     self.assertEqual(sheet.cell('L2').value, u'Risk comment')
예제 #28
0
 def createSqlData(self):
     self.session = Session()
     account = model.Account(loginname="jane", password="******")
     self.session.add(account)
     self.survey = model.SurveySession(title="Survey",
                                       zodb_path="survey",
                                       account=account)
     self.session.add(self.survey)
     self.session.flush()
     self.mod1 = self.survey.addChild(
         model.Module(title="module 1", module_id="1", zodb_path="a"))
     self.q1 = self.mod1.addChild(
         model.Risk(title="question 1", risk_id="1", zodb_path="a/b"))
     self.session.flush()
예제 #29
0
 def testSkipRiskIfNotPresent(self):
     (session, survey) = createSurvey()
     mod1 = model.Module(title="Module 1",
                         module_id="1",
                         zodb_path="1",
                         skip_children=False)
     survey.addChild(mod1)
     q11 = model.Risk(title="Risk 1.1",
                      risk_id="1",
                      zodb_path="1/1",
                      identification="yes")
     mod1.addChild(q11)
     self.assertEqual(
         navigation.FindNextQuestion(mod1, survey, self.filter()), None)
예제 #30
0
 def setUp(self):
     super(TestRiskImageDownloadUpload, self).setUp()
     self.loginAsPortalOwner()
     self.account = addAccount(password="******")
     addSurvey(self.portal, BASIC_SURVEY)
     survey_session = model.SurveySession(
         title="Dummy session",
         zodb_path="nl/ict/software-development",
         account=self.account,
     )
     self.risk = survey_session.addChild(
         model.Risk(title="risk 1",
                    zodb_path="1")).__of__(survey_session.traversed_session)
     model.Session.add(survey_session)