def render_admin_panel(self, req, cat, page, path_info): """ main request handler """ if TESTER_PERMISSION in req.perm: #template data data = dict() data["info"] = req.args.get("info", "") data["warning"] = req.args.get("warning", "") data["error"] = req.args.get("error", "") data["display_status"] = get_display_states(self) data["id"] = req.args.get("path_info", None) data["page"] = 'TestManager_accordion.html' data["url"] = req.abs_href + req.path_info # get the testcase data['priorities'] = self.get_priorities() data['default_priority'] = self.get_default_priority() if data["id"]: try: testcase = models.TestCaseQuery( self.env, tcid=data['id'] ).execute()[0] for action in testcase.actions: action.color = { "style": ("background:%s" % get_status_color(action.status)) } data["TestCaseTitle"] = testcase.title.strip('=') data["TestCaseDescription"] = testcase.description data["TestCaseActions"] = testcase.actions data["revision"] = testcase.revision data["title"] = '(%s) ' % testcase.tcid + testcase.wiki # XXX: we have to fix this in 1.0 because # wiki_to_html is deprecated for action in testcase.actions: action.description = wiki_to_html( action.description, self.env, req) action.expected_result = wiki_to_html( "''Result:''[[BR]]" + action.expected_result, self.env, req) for comment in action.comments: comment["text"] = wiki_to_html( comment["text"], self.env, req) if req.authname != testcase.tester: # assigned to someone else # but can be done by mr urlaubsvertretung data["warning"] = 'this testcase %s %s' % ( 'has been assigned to', testcase.tester) except TracError: # not found data["error"] = '%s %s %s' % ('the requested testcase ', 'could not be found or has', 'been erased') return data["page"], data
def expand_macro(self, formatter, name, content): req = formatter.req kwargs = self._parse_macro_content(content, req) self.env.log.debug("Macro Args: %s" % kwargs) out = StringIO.StringIO() self.components = self.compmgr.components display = get_display_states(self) # get testrun # TODO: get the config - we have to make the config # persistent in some way # now we take more than one testrun to monitor # TODO: should we really split this here? tcs = TestCaseQuery(self.env, testrun=kwargs['testrun']).execute() text = "\n||'''Test case'''||'''User'''||'''Status'''||\n" for tc in tcs: tc.color = get_status_color(tc.status) tc_data = { "testcase": "[%s/TestManager/general/testcase/%s #%s %s]" % ( req.abs_href(), tc.id, tc.id, tc.title.replace('=', '').strip() ), "tester": tc.tester, "status": display.get(STATES_DISPLAY.get(tc.status)), "color": tc.color } text += """{{{#!td style="background: %(color)s" %(testcase)s }}} {{{#!td style="background: %(color)s" %(tester)s }}} {{{#!td style="background: %(color)s" %(status)s }}} |---------------- """ % tc_data # ... and finally display them Formatter(self.env, formatter.context).format(text, out) return Markup(out.getvalue())