def _validate_ticket(self, req, ticket, force_collision_check=False): if 'ts' in req.args: match = re.search('^(\d+)$', req.args.get('ts') or '') if match: timestamp = int(match.group(1)) last_changed = datetime.utcfromtimestamp(timestamp).replace(tzinfo=utc) req.args['ts'] = str(last_changed) ticket_system = AgiloTicketSystem(self.env) trac_ticket_system = super(AgiloTicketModule, self) if ticket_system.is_trac_012(): return trac_ticket_system._validate_ticket(req, ticket, force_collision_check=force_collision_check) return trac_ticket_system._validate_ticket(req, ticket)
def _validate_ticket(self, req, ticket, force_collision_check=False): if 'ts' in req.args: match = re.search('^(\d+)$', req.args.get('ts') or '') if match: timestamp = int(match.group(1)) last_changed = datetime.utcfromtimestamp(timestamp).replace( tzinfo=utc) req.args['ts'] = str(last_changed) ticket_system = AgiloTicketSystem(self.env) trac_ticket_system = super(AgiloTicketModule, self) if ticket_system.is_trac_012(): return trac_ticket_system._validate_ticket( req, ticket, force_collision_check=force_collision_check) return trac_ticket_system._validate_ticket(req, ticket)
def test_fields_for_task(self): """Tests how the FieldsWrapper respond with a task type""" ticket_system = AgiloTicketSystem(self.env) tfw = FieldsWrapper(self.env, ticket_system.get_ticket_fields(), Type.TASK) expected_fields_for_task = AgiloConfig(self.env).TYPES.get(Type.TASK) # Try to check the keys field_wrapper_names = map(lambda field: field[Key.NAME], tfw) # it is added by the ticket system to store sprint # scope synchronous with milestone field_wrapper_names.remove(Key.MILESTONE) expected_fields_for_task.remove('id') if not ticket_system.is_trac_012(): # in Trac 0.11, time fields are magic field_wrapper_names.append('changetime') field_wrapper_names.append('time') self.assert_equals(sorted(expected_fields_for_task), sorted(field_wrapper_names))