public void testGetTicketActionsClosed() throws Exception { TracTicket ticket = harness.createTicket("getTicketActionsClosed"); ticket.putBuiltinValue(Key.STATUS, "closed"); ticket.putBuiltinValue(Key.RESOLUTION, "fixed"); client.updateTicket(ticket, "", null); ticket = client.getTicket(ticket.getId(), null); TracAction[] actions = ticket.getActions(); assertNotNull(actions); assertEquals(2, actions.length); assertEquals("leave", actions[0].getId()); assertEquals("reopen", actions[1].getId()); }
public void testSearchValidateTicket() throws Exception { String uniqueTag = RandomStringUtils.randomAlphanumeric(6); TracTicket ticket = harness.createTicket("searchValidateTicket " + uniqueTag); ticket.putBuiltinValue(Key.COMPONENT, "component1"); ticket.putBuiltinValue(Key.DESCRIPTION, "description1"); ticket.putBuiltinValue(Key.MILESTONE, "milestone1"); ticket.putBuiltinValue(Key.REPORTER, "anonymous"); client.updateTicket(ticket, "", null); TracSearch search = new TracSearch(); search.addFilter(new TracSearchFilter("summary", CompareOperator.CONTAINS, uniqueTag)); List<TracTicket> result = new ArrayList<TracTicket>(); client.search(search, result, null); assertEquals(1, result.size()); // the value varies between Trac versions, e.g. "somebody", "< default >" ticket.putBuiltinValue(Key.OWNER, result.get(0).getValue(Key.OWNER)); TracTestUtil.assertTicketEquals(ticket, result.get(0)); }
public void testInvalidCharacters() throws Exception { TracTicket ticket = harness.createTicket("invalid characters"); ticket.putBuiltinValue(Key.DESCRIPTION, "Control Character: \u0002"); try { client.updateTicket(ticket, "set invalid characters in description", null); fail("Expected TracException"); } catch (TracException e) { // expected to cause parse error } }