diff --git a/swh/model/model.py b/swh/model/model.py --- a/swh/model/model.py +++ b/swh/model/model.py @@ -296,7 +296,8 @@ return ov def unique_key(self) -> KeyType: - return {"origin": self.origin, "date": str(self.date)} + assert self.visit is not None + return {"origin": self.origin, "visit": str(self.visit)} @attr.s(frozen=True) 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 @@ -76,9 +76,9 @@ date = datetime.datetime.now(tz=datetime.timezone.utc) id_ = b"42" * 10 assert Origin(url=url).unique_key() == {"url": url} - assert OriginVisit(origin=url, date=date, type="git").unique_key() == { + assert OriginVisit(origin=url, visit=42, date=date, type="git").unique_key() == { "origin": url, - "date": str(date), + "visit": "42", } assert OriginVisitStatus( origin=url, visit=42, date=date, status="created", snapshot=None