Ejemplo n.º 1
0
 def view(self):
     if not self._view:
         if not self._view_cls:
             from viewflow.views import StartProcessView
             return StartProcessView.as_view()
         else:
             self._view = self._view_cls.as_view(**self._view_args)
             return self._view
     return self._view
Ejemplo n.º 2
0
 def view(self):
     if not self._view:
         if not self._view_cls:
             from viewflow.views import StartProcessView
             return StartProcessView.as_view()
         else:
             self._view = self._view_cls.as_view(**self._view_args)
             return self._view
     return self._view
Ejemplo n.º 3
0
    def test_startprocess_view(self):
        view = StartProcessView.as_view()
        user = User.objects.create(username='******', is_superuser=True)

        # get
        request = RequestFactory().get('/start/')
        request.user = user
        response = view(request, flow_cls=StartViewTestFlow, flow_task=StartViewTestFlow.start)

        self.assertEqual(response.template_name,
                         ('tests/test_views_start/startviewtest/start.html',
                          'tests/test_views_start/startviewtest/start.html',
                          'viewflow/flow/start.html'))

        # post
        request = RequestFactory().post('/start/')
        request.user = user
        response = view(request, flow_cls=StartViewTestFlow, flow_task=StartViewTestFlow.start)
        self.assertEqual(response.status_code, 302)

        process = StartViewTestFlow.process_cls.objects.all()[0]
        process.get_task(StartViewTestFlow.start, status=[STATUS.DONE])