예제 #1
0
 def test_get_ticket_command(self):
     """Tests the get ticket command"""
     t1 = self.teh.create_ticket(Type.TASK,
                                 props={Key.REMAINING_TIME: '12'})
     cmd_get = TicketController.GetTicketCommand(self.env, ticket=t1.id)
     t1_c = self.controller.process_command(cmd_get)
     self.assert_not_none(t1_c)
     self.assert_equals(t1[Key.SUMMARY], t1_c[Key.SUMMARY])
     # Try a non existing ticket
     try:
         cmd_get.ticket = 0
         self.fail("Could set 0 as a ticket id")
     except validator.ValidationError:
         pass
예제 #2
0
 def test_save_ticket_command(self):
     """Tests the save ticket command"""
     cmd_create = TicketController.CreateTicketCommand(
         self.env, summary='This is a ticket')
     t = self.controller.process_command(cmd_create)
     self.assert_true(t.exists)
     self.assert_equals('This is a ticket', t[Key.SUMMARY])
     cmd_save = TicketController.SaveTicketCommand(
         self.env, ticket=t.id, properties={Key.DESCRIPTION: 'Hey!'})
     self.controller.process_command(cmd_save)
     # Now verify that the ticket has really been saved
     self.controller.manager.get_cache().invalidate()
     cmd_get = TicketController.GetTicketCommand(self.env, ticket=t.id)
     t_reloaded = self.controller.process_command(cmd_get)
     self.assert_not_none(t_reloaded)
     self.assert_equals('Hey!', t_reloaded[Key.DESCRIPTION])