From 661b7c2c76bbd74433ad10427fb2e9875d755a16 Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <ardumont@softwareheritage.org>
Date: Wed, 24 Jun 2020 09:13:01 +0200
Subject: [PATCH] OriginVisitStatus: Allow "created" status

Related to T2310
---
 swh/model/hypothesis_strategies.py | 2 +-
 swh/model/model.py                 | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/swh/model/hypothesis_strategies.py b/swh/model/hypothesis_strategies.py
index bb10b78a..e28d74e6 100644
--- a/swh/model/hypothesis_strategies.py
+++ b/swh/model/hypothesis_strategies.py
@@ -177,7 +177,7 @@ def origin_visit_statuses_d():
         dict,
         visit=integers(1, 1000),
         origin=urls(),
-        status=sampled_from(["ongoing", "full", "partial"]),
+        status=sampled_from(["created", "ongoing", "full", "partial"]),
         date=aware_datetimes(),
         snapshot=optional(sha1_git()),
         metadata=optional(metadata_dicts()),
diff --git a/swh/model/model.py b/swh/model/model.py
index ed19aa2f..220733f4 100644
--- a/swh/model/model.py
+++ b/swh/model/model.py
@@ -263,7 +263,8 @@ class OriginVisitStatus(BaseModel):
 
     date = attr.ib(type=datetime.datetime, validator=type_validator())
     status = attr.ib(
-        type=str, validator=attr.validators.in_(["ongoing", "full", "partial"])
+        type=str,
+        validator=attr.validators.in_(["created", "ongoing", "full", "partial"]),
     )
     snapshot = attr.ib(type=Optional[Sha1Git], validator=type_validator())
     metadata = attr.ib(
-- 
GitLab