From c1797a2bb51c1b28fcc936b90df9b03fdfb623ad Mon Sep 17 00:00:00 2001
From: Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Date: Fri, 24 May 2024 22:42:26 +0200
Subject: [PATCH] deprecation: also fix some deprecation in test_identifiers

git_objects.snapshot_git_object wants Snapshot argument, lets move
things to Snapshot object.
---
 swh/model/tests/test_identifiers.py | 53 ++++++++++++++++-------------
 1 file changed, 30 insertions(+), 23 deletions(-)

diff --git a/swh/model/tests/test_identifiers.py b/swh/model/tests/test_identifiers.py
index 054687af..c0880bc0 100644
--- a/swh/model/tests/test_identifiers.py
+++ b/swh/model/tests/test_identifiers.py
@@ -718,45 +718,52 @@ class SnapshotIdentifier(unittest.TestCase):
     def setUp(self):
         super().setUp()
 
-        self.empty = {
-            "id": _x("1a8893e6a86f444e8be8e7bda6cb34fb1735a00e"),
-            "branches": {},
-        }
+        self.empty = Snapshot.from_dict(
+            {
+                "id": _x("1a8893e6a86f444e8be8e7bda6cb34fb1735a00e"),
+                "branches": {},
+            }
+        )
 
-        self.dangling_branch = {
-            "id": _x("c84502e821eb21ed84e9fd3ec40973abc8b32353"),
-            "branches": {
-                b"HEAD": None,
-            },
-        }
+        self.dangling_branch = Snapshot.from_dict(
+            {
+                "id": _x("c84502e821eb21ed84e9fd3ec40973abc8b32353"),
+                "branches": {
+                    b"HEAD": None,
+                },
+            }
+        )
 
-        self.unresolved = {
-            "id": _x("84b4548ea486e4b0a7933fa541ff1503a0afe1e0"),
-            "branches": {
-                b"foo": {
-                    "target": b"bar",
-                    "target_type": "alias",
+        self.unresolved = Snapshot.from_dict(
+            {
+                "id": _x("84b4548ea486e4b0a7933fa541ff1503a0afe1e0"),
+                "branches": {
+                    b"foo": {
+                        "target": b"bar",
+                        "target_type": "alias",
+                    },
                 },
-            },
-        }
+            }
+        )
 
         self.all_types = snapshot_example
 
     def test_empty_snapshot(self):
         self.assertEqual(
-            Snapshot.from_dict(remove_id(self.empty)).id,
-            self.empty["id"],
+            Snapshot.from_dict(remove_id(self.empty.to_dict())).id,
+            self.empty.id,
         )
 
     def test_dangling_branch(self):
         self.assertEqual(
-            Snapshot.from_dict(remove_id(self.dangling_branch)).id,
-            self.dangling_branch["id"],
+            Snapshot.from_dict(remove_id(self.dangling_branch.to_dict())).id,
+            self.dangling_branch.id,
         )
 
     def test_unresolved(self):
         self.assertEqual(
-            Snapshot.from_dict(remove_id(self.unresolved)).id, self.unresolved["id"]
+            Snapshot.from_dict(remove_id(self.unresolved.to_dict())).id,
+            self.unresolved.id,
         )
 
     def test_git_object_unresolved(self):
-- 
GitLab