diff --git a/joeflow/views.py b/joeflow/views.py index fdb921a..072391f 100644 --- a/joeflow/views.py +++ b/joeflow/views.py @@ -58,9 +58,7 @@ def get_task(self): def next_task(self): task = self.get_task() - task.workflow = self.model._base_manager.get( - pk=self.model._base_manager.get(pk=self.object.pk) - ) + task.workflow = self.model._base_manager.get(pk=self.object.pk) task.finish(self.request.user) task.start_next_tasks() diff --git a/tests/tasks/test_human.py b/tests/tasks/test_human.py index e69de29..ddc2b92 100644 --- a/tests/tasks/test_human.py +++ b/tests/tasks/test_human.py @@ -0,0 +1,17 @@ +import pytest + +from tests.testapp import workflows + + +class TestStartView: + def test_get(self, client): + response = client.get("/simple/start_view/custom/postfix/") + assert response.status_code == 200 + + @pytest.mark.django_db + def test_post(self, client): + assert not workflows.SimpleWorkflow.objects.exists() + response = client.post("/simple/start_view/custom/postfix/") + assert response.status_code == 302 + assert response["Location"] == "/simple/1/" + assert workflows.SimpleWorkflow.objects.exists()