def testRisksOverviewView(self): interface.alsoProvides(self.request, IOSHAClientSkinLayer) view = component.getMultiAdapter((PathGhost("casper"), self.request), name="risks_overview") view.getModules = self._getModules view.getRisks = self._getRisks view.tocdata = { "001001": { "path": "001001", "title": "Shops are clean - Somerset West", "locations": [], "number": 1, } } view.getStatus() self.assertEquals( len(view.risks_by_status["001001"]["present"]["high"]), 1) self.assertEquals( len(view.risks_by_status["001001"]["present"]["medium"]), 1) self.assertEquals( len(view.risks_by_status["001001"]["present"]["low"]), 1) self.assertEquals( len(view.risks_by_status["001001"]["possible"]["postponed"]), 1) self.assertEquals( len(view.risks_by_status["001001"]["possible"]["todo"]), 1)
def testRisksOverviewView(self): interface.alsoProvides(self.request, euphorie_interfaces.IReportPhaseSkinLayer) view = component.getMultiAdapter((PathGhost('casper'), self.request), name="risks_overview") view.getModules = self._getModules view.getRisks = self._getRisks view.tocdata = { u'001001': { 'path': u'001001', 'title': u'Shops are clean - Somerset West', 'locations': [], 'number': 1, } } view.getStatus() self.assertEquals( len(view.risks_by_status[u'001001']['present']['high']), 1) self.assertEquals( len(view.risks_by_status[u'001001']['present']['medium']), 1) self.assertEquals( len(view.risks_by_status[u'001001']['present']['low']), 1) self.assertEquals( len(view.risks_by_status[u'001001']['possible']['postponed']), 1) self.assertEquals( len(view.risks_by_status[u'001001']['possible']['todo']), 1)
def test_ignore_non_survey_child(self): from zope.publisher.browser import TestRequest from euphorie.ghost import PathGhost from euphorie.client.sector import ClientSector sector = ClientSector(id='ict', title=u'ICT') sector['gaming'] = PathGhost('gaming') response = self.View(sector, TestRequest()).do_GET() self.assertEqual(response['surveys'], [])
def test_ignore_non_sector_child(self): from euphorie.ghost import PathGhost from zope.publisher.browser import TestRequest from euphorie.client.country import ClientCountry country = ClientCountry(id='nl', title=u'The Netherlands', country_type='eu-member') country['ict'] = PathGhost('ict') response = self.View(country, TestRequest()).do_GET() self.assertEqual(response['sectors'], [])
def build_tree_aq_chain(root, tree_id): """Build an acquisition context for a tree node. XXX This uses the path ghost and is obsolete """ tail = Session.query(SurveyTreeItem).get(tree_id) walker = root path = tail.path while len(path) > 3: id = str(int(path[:3])) path = path[3:] walker = PathGhost(id).__of__(walker) return tail.__of__(walker)
def testUnactionedNodes(self): self.createData() interface.alsoProvides(self.portal.REQUEST, IReportPhaseSkinLayer) view = component.getMultiAdapter( (PathGhost('dummy'), self.portal.REQUEST), name="download") view.session = self.survey_session if view.session.company is None: self.session.company = model.Company() nodes = view.getNodes() self.assertEqual(len(utils.get_unactioned_nodes(nodes)), 3)