~cjohnston/uci-engine/1318774

« back to all changes in this revision

Viewing changes to ticket_system/ticket/tests/test_write_api.py

  • Committer: Ubuntu CI Bot
  • Author(s): Andy Doan
  • Date: 2014-05-12 15:49:28 UTC
  • mfrom: (466.2.4 ts-model)
  • Revision ID: ubuntu_ci_bot-20140512154928-ng6cll5viw6ylgji
[r=PS Jenkins bot, Chris Johnston] ticket-api: simplify status values

Simplifies the TicketWorkflowStepStatus values to be consistent
and let the user infer the workflow-step using the "current_workflow_step"
attribute of a ticket.  from Andy Doan

Show diffs side-by-side

added added

removed removed

Lines of Context:
282
282
            'current_workflow_step': str(
283
283
                TicketWorkflowStep.IMAGE_BUILDING.value),
284
284
            'status': str(
285
 
                TicketWorkflowStepStatus.IMAGE_BUILDING_COMPLETED.value),
 
285
                TicketWorkflowStepStatus.COMPLETED.value),
286
286
        }
287
287
        self.assertEqual(Ticket.objects.count(), 1)
288
288
        self.assertEqual(BinaryPackage.objects.count(), 3)
306
306
            int(TicketWorkflowStep.IMAGE_BUILDING))
307
307
        self.assertEqual(
308
308
            Ticket.objects.get(pk=self.ticket.pk).status,
309
 
            int(TicketWorkflowStepStatus.IMAGE_BUILDING_COMPLETED))
 
309
            int(TicketWorkflowStepStatus.COMPLETED))
310
310
 
311
311
    def test_update_ticket_status_complete(self):
312
312
        new_data = {
345
345
    def test_update_ticket_status_failed(self):
346
346
        '''Ensure we fail a ticket properly
347
347
 
348
 
        Let's not assume users of this API will update the ticket-status to
349
 
        failed when a workflow step fails. Ensure the API corrects this for
350
 
        the user.
 
348
        The workflow step should indicate where the ticket failed. The status
 
349
        is how you know if it failed
351
350
        '''
 
351
        step = TicketWorkflowStep.PKG_BUILDING
352
352
        new_data = {
353
 
            "current_workflow_step": str(TicketWorkflowStep.COMPLETED.value),
354
 
            "status": TicketWorkflowStepStatus.PKG_BUILDING_FAILED.value,
 
353
            "current_workflow_step": str(step.value),
 
354
            "status": TicketWorkflowStepStatus.FAILED.value,
355
355
        }
356
356
        self.assertEqual(Ticket.objects.count(), 1)
357
357
        self.assertEqual(Ticket.objects.get(
364
364
        self.assertEqual(Ticket.objects.count(), 1)
365
365
        self.assertEqual(Ticket.objects.get(
366
366
            pk=self.ticket.pk).current_workflow_step,
367
 
            int(TicketWorkflowStep.FAILED))
 
367
            int(step))
368
368
        self.assertEqual(Ticket.objects.get(
369
369
            pk=self.ticket.pk).status,
370
 
            int(TicketWorkflowStepStatus.PKG_BUILDING_FAILED))
 
370
            int(TicketWorkflowStepStatus.FAILED))
371
371
 
372
372
    def test_try_adding_binary_already_in_list(self):
373
373
        """