diff --git a/swh/model/hypothesis_strategies.py b/swh/model/hypothesis_strategies.py index 0c54a994e7d6dbb0df372868faea5f8a2c81be58..da04769df07274b2c41fcb4642097a9cbe11e560 100644 --- a/swh/model/hypothesis_strategies.py +++ b/swh/model/hypothesis_strategies.py @@ -174,6 +174,7 @@ def origin_visit_statuses_d(): dict, visit=integers(1, 1000), origin=urls(), + type=optional(sampled_from(["git", "svn", "pypi", "debian"])), status=sampled_from(["created", "ongoing", "full", "partial"]), date=aware_datetimes(), snapshot=optional(sha1_git()), diff --git a/swh/model/model.py b/swh/model/model.py index 65ffdfd483a966c83960e7a2a53a26e6dec6a148..e373e2065be760b86168ef93e3fa34f65f90daef 100644 --- a/swh/model/model.py +++ b/swh/model/model.py @@ -323,6 +323,8 @@ class OriginVisitStatus(BaseModel): validator=attr.validators.in_(["created", "ongoing", "full", "partial"]), ) 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 + type = attr.ib(type=Optional[str], validator=type_validator(), default=None) metadata = attr.ib( type=Optional[ImmutableDict[str, object]], validator=type_validator(),