示例#1
0
 def test_user_update_state_post(self):
     request = self.rf.post(reverse('ticket-update', kwargs=self.ticket_kwargs), {'transition': 'open'})
     request.user = self.user
     # https://stackoverflow.com/questions/15852317/you-cannot-add-messages-without-installing-django-contrib-messages-middleware-me
     setattr(request, 'session', 'session')
     messages = FallbackStorage(request)
     setattr(request, '_messages', messages)
     response = views.update_state_ticket_view(request, **self.ticket_kwargs)
     assert_code(response, 302)
     ticket = Ticket.objects.get(pk=self.test_ticket.pk)
     eq_(ticket.state, TICKET_STATES.OPEN)
示例#2
0
 def test_user_update_state_get(self):
     request = self.rf.get(reverse('ticket-update', kwargs=self.ticket_kwargs), {'transition': 'open'})
     request.user = self.user
     response = views.update_state_ticket_view(request, **self.ticket_kwargs)
     assert_code(response, 405)