示例#1
0
 def test_risk_with_interfaces_already_set(self):
     from euphorie.content.tests.utils import createSector
     from euphorie.content.tests.utils import addSurvey
     from euphorie.content.risk import IKinneyEvaluation
     from euphorie.content.risk import IFrenchEvaluation
     self.loginAsPortalOwner()
     sector = createSector(self.portal)
     survey = addSurvey(sector)
     risk = survey["1"]["2"]
     self.assertTrue(IKinneyEvaluation.providedBy(risk))
     self.assertTrue(not IFrenchEvaluation.providedBy(risk))
     self.set_evaluation_method_interfaces(self.portal)
     self.assertTrue(IKinneyEvaluation.providedBy(risk))
     self.assertTrue(not IFrenchEvaluation.providedBy(risk))
示例#2
0
 def test_risk_with_interfaces_already_set(self):
     from euphorie.content.tests.utils import createSector
     from euphorie.content.tests.utils import addSurvey
     from euphorie.content.risk import IKinneyEvaluation
     from euphorie.content.risk import IFrenchEvaluation
     self.loginAsPortalOwner()
     sector = createSector(self.portal)
     survey = addSurvey(sector)
     risk = survey["1"]["2"]
     self.assertTrue(IKinneyEvaluation.providedBy(risk))
     self.assertTrue(not IFrenchEvaluation.providedBy(risk))
     self.set_evaluation_method_interfaces(self.portal)
     self.assertTrue(IKinneyEvaluation.providedBy(risk))
     self.assertTrue(not IFrenchEvaluation.providedBy(risk))
示例#3
0
 def test_set_kinney_interface(self):
     from zope.interface import noLongerProvides
     from euphorie.content.tests.utils import createSector
     from euphorie.content.tests.utils import addSurvey
     from euphorie.content.risk import IKinneyEvaluation
     from euphorie.content.risk import IFrenchEvaluation
     self.loginAsPortalOwner()
     sector = createSector(self.portal)
     survey = addSurvey(sector)
     risk = survey["1"]["2"]
     noLongerProvides(risk, IKinneyEvaluation)
     self.assertTrue(not IKinneyEvaluation.providedBy(risk))
     self.set_evaluation_method_interfaces(self.portal)
     self.assertTrue(IKinneyEvaluation.providedBy(risk))
     self.assertTrue(not IFrenchEvaluation.providedBy(risk))
示例#4
0
 def test_set_kinney_interface(self):
     from zope.interface import noLongerProvides
     from euphorie.content.tests.utils import createSector
     from euphorie.content.tests.utils import addSurvey
     from euphorie.content.risk import IKinneyEvaluation
     from euphorie.content.risk import IFrenchEvaluation
     self.loginAsPortalOwner()
     sector = createSector(self.portal)
     survey = addSurvey(sector)
     risk = survey["1"]["2"]
     noLongerProvides(risk, IKinneyEvaluation)
     self.assertTrue(not IKinneyEvaluation.providedBy(risk))
     self.set_evaluation_method_interfaces(self.portal)
     self.assertTrue(IKinneyEvaluation.providedBy(risk))
     self.assertTrue(not IFrenchEvaluation.providedBy(risk))
示例#5
0
 def testImportRisk_CalculatedEvaluation_French(self):
     from Acquisition import aq_parent
     from euphorie.content.risk import IFrenchEvaluation
     snippet = objectify.fromstring(
     """<risk type="risk" xmlns="http://xml.simplon.biz/euphorie/survey/1.0">
          <title>Are your desks at the right height?</title>
          <description>&lt;p&gt;The right height is important to prevent back problems.&lt;/p&gt;</description>
          <evaluation-method default-severity="very-severe" default-frequency="often">calculated</evaluation-method>
        </risk>""")
     self.loginAsPortalOwner()
     module = self.createModule()
     group = aq_parent(aq_parent(module))
     group.evaluation_algorithm = u"french"
     importer = upload.SurveyImporter(None)
     risk = importer.ImportRisk(snippet, module)
     self.assertTrue(IFrenchEvaluation.providedBy(risk))
     self.assertEqual(risk.show_notapplicable, False)
     self.assertEqual(risk.evaluation_method, "calculated")
     self.assertEqual(risk.default_severity, 10)
     self.assertEqual(risk.default_frequency, 7)
 def testImportRisk_CalculatedEvaluation_French(self):
     from Acquisition import aq_parent
     from euphorie.content.risk import IFrenchEvaluation
     snippet = objectify.fromstring(
         """<risk type="risk" xmlns="http://xml.simplon.biz/euphorie/survey/1.0">
          <title>Are your desks at the right height?</title>
          <description>&lt;p&gt;The right height is important to prevent back problems.&lt;/p&gt;</description>
          <evaluation-method default-severity="very-severe" default-frequency="often">calculated</evaluation-method>
        </risk>""")
     self.loginAsPortalOwner()
     module = self.createModule()
     group = aq_parent(aq_parent(module))
     group.evaluation_algorithm = u"french"
     importer = upload.SurveyImporter(None)
     risk = importer.ImportRisk(snippet, module)
     self.assertTrue(IFrenchEvaluation.providedBy(risk))
     self.assertEqual(risk.show_notapplicable, False)
     self.assertEqual(risk.evaluation_method, "calculated")
     self.assertEqual(risk.default_severity, 10)
     self.assertEqual(risk.default_frequency, 7)