diff --git a/swh/model/hypothesis_strategies.py b/swh/model/hypothesis_strategies.py --- a/swh/model/hypothesis_strategies.py +++ b/swh/model/hypothesis_strategies.py @@ -79,7 +79,7 @@ return builds( OriginVisit, visit=integers(0, 1000), - origin=origins(), + origin=urls(), status=sampled_from(['ongoing', 'full', 'partial']), type=pgsql_text()) diff --git a/swh/model/model.py b/swh/model/model.py --- a/swh/model/model.py +++ b/swh/model/model.py @@ -121,7 +121,7 @@ class OriginVisit(BaseModel): """Represents a visit of an origin at a given point in time, by a SWH loader.""" - origin = attr.ib(type=Origin) + origin = attr.ib(type=str) date = attr.ib(type=datetime.datetime) status = attr.ib( type=str, @@ -149,7 +149,6 @@ d = d.copy() date = d.pop('date') return cls( - origin=Origin.from_dict(d.pop('origin')), date=(date if isinstance(date, datetime.datetime) else dateutil.parser.parse(date)), diff --git a/swh/model/tests/test_model.py b/swh/model/tests/test_model.py --- a/swh/model/tests/test_model.py +++ b/swh/model/tests/test_model.py @@ -3,7 +3,6 @@ # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information -import attr import copy from hypothesis import given @@ -44,10 +43,7 @@ def test_todict_origin_visits(origin_visit): obj = origin_visit.to_dict() - assert 'type' not in obj['origin'] - origin2 = attr.evolve(origin_visit.origin, type=None) - origin_visit2 = attr.evolve(origin_visit, origin=origin2) - assert origin_visit2 == type(origin_visit).from_dict(obj) + assert origin_visit == type(origin_visit).from_dict(obj) def test_content_get_hash():