From 3e70d1c09c1a3c6d7263b6610be1e8cbe96603d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9o=20Lesage?= <tlesage@teklia.com>
Date: Fri, 3 May 2024 11:43:00 +0200
Subject: [PATCH] Fix linting, missing argument in restart test and old things
 in api

---
 arkindex/ponos/api.py            | 1 -
 arkindex/ponos/models.py         | 1 -
 arkindex/ponos/tests/test_api.py | 1 +
 3 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arkindex/ponos/api.py b/arkindex/ponos/api.py
index 302c60ce29..368a44055b 100644
--- a/arkindex/ponos/api.py
+++ b/arkindex/ponos/api.py
@@ -235,7 +235,6 @@ class TaskRestart(ProcessACLMixin, CreateAPIView):
         parents = list(copy.parents.all())
 
         # Rename the original task
-        basename, *_ = copy.slug.rsplit("_old", 1)
         if copy.original_task_id:
             basename, *_ = copy.slug.rsplit("_old", 1)
         else:
diff --git a/arkindex/ponos/models.py b/arkindex/ponos/models.py
index d2c6ad7d76..76a91f8a15 100644
--- a/arkindex/ponos/models.py
+++ b/arkindex/ponos/models.py
@@ -332,7 +332,6 @@ class Task(models.Model):
         null=True,
         blank=True,
     )
-
     original_task = models.ForeignKey(
         "self",
         on_delete=models.SET_NULL,
diff --git a/arkindex/ponos/tests/test_api.py b/arkindex/ponos/tests/test_api.py
index 0e21aa2a62..7e9f2db698 100644
--- a/arkindex/ponos/tests/test_api.py
+++ b/arkindex/ponos/tests/test_api.py
@@ -635,6 +635,7 @@ class TestAPI(FixtureAPITestCase):
             mock_now.return_value = datetime.now(timezone.utc) + timedelta(minutes=1)
             old_task_2 = self.process.tasks.create(run=self.task1.run, depth=1, slug=f"{task_2_slug}_old1")
             old_task_2.state = State.Error.value
+            old_task_2.original_task_id = self.task1.id
             old_task_2.save()
         old_task_2.parents.add(self.task1)
         self.task1.state = State.Completed.value
-- 
GitLab