From 9af451fd6248ea3159f35bcca23e6ef28c7f505a Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <ardumont@softwareheritage.org>
Date: Wed, 20 Jan 2021 10:31:38 +0100
Subject: [PATCH] model: Allow new status values not_found and failed to
 OriginVisitStatus

Related to T2961
---
 swh/model/hypothesis_strategies.py | 4 +++-
 swh/model/model.py                 | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/swh/model/hypothesis_strategies.py b/swh/model/hypothesis_strategies.py
index da04769d..99573e23 100644
--- a/swh/model/hypothesis_strategies.py
+++ b/swh/model/hypothesis_strategies.py
@@ -175,7 +175,9 @@ def origin_visit_statuses_d():
         visit=integers(1, 1000),
         origin=urls(),
         type=optional(sampled_from(["git", "svn", "pypi", "debian"])),
-        status=sampled_from(["created", "ongoing", "full", "partial"]),
+        status=sampled_from(
+            ["created", "ongoing", "full", "partial", "not_found", "failed"]
+        ),
         date=aware_datetimes(),
         snapshot=optional(sha1_git()),
         metadata=optional(metadata_dicts()),
diff --git a/swh/model/model.py b/swh/model/model.py
index e373e206..10b39f20 100644
--- a/swh/model/model.py
+++ b/swh/model/model.py
@@ -320,7 +320,9 @@ class OriginVisitStatus(BaseModel):
     date = attr.ib(type=datetime.datetime, validator=type_validator())
     status = attr.ib(
         type=str,
-        validator=attr.validators.in_(["created", "ongoing", "full", "partial"]),
+        validator=attr.validators.in_(
+            ["created", "ongoing", "full", "partial", "not_found", "failed"]
+        ),
     )
     snapshot = attr.ib(type=Optional[Sha1Git], validator=type_validator())
     # Type is optional be to able to use it before adding it to the database model
-- 
GitLab