Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7124349
D3537.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D3537.diff
View Options
diff --git a/swh/loader/package/cran/tests/test_cran.py b/swh/loader/package/cran/tests/test_cran.py
--- a/swh/loader/package/cran/tests/test_cran.py
+++ b/swh/loader/package/cran/tests/test_cran.py
@@ -19,7 +19,7 @@
)
from swh.core.tarball import uncompress
from swh.model.hashutil import hash_to_bytes
-from swh.model.model import TimestampWithTimezone
+from swh.model.model import Snapshot, SnapshotBranch, TargetType, TimestampWithTimezone
from swh.loader.tests import (
assert_last_visit_matches,
@@ -28,6 +28,20 @@
)
+SNAPSHOT = Snapshot(
+ id=hash_to_bytes("920adcccc78aaeedd3cfa4459dd900d8c3431a21"),
+ branches={
+ b"HEAD": SnapshotBranch(
+ target=b"releases/2.22-6", target_type=TargetType.ALIAS
+ ),
+ b"releases/2.22-6": SnapshotBranch(
+ target=hash_to_bytes("42bdb16facd5140424359c8ce89a28ecfa1ce603"),
+ target_type=TargetType.REVISION,
+ ),
+ },
+)
+
+
def test_cran_parse_date():
data = [
# parsable, some have debatable results though
@@ -169,23 +183,12 @@
actual_load_status = loader.load()
- expected_snapshot_id = "920adcccc78aaeedd3cfa4459dd900d8c3431a21"
assert actual_load_status == {
"status": "eventful",
- "snapshot_id": expected_snapshot_id,
+ "snapshot_id": SNAPSHOT.id.hex(),
}
- expected_snapshot = {
- "id": hash_to_bytes(expected_snapshot_id),
- "branches": {
- b"HEAD": {"target": b"releases/2.22-6", "target_type": "alias"},
- b"releases/2.22-6": {
- "target": hash_to_bytes("42bdb16facd5140424359c8ce89a28ecfa1ce603"),
- "target_type": "revision",
- },
- },
- }
- check_snapshot(expected_snapshot, loader.storage)
+ check_snapshot(SNAPSHOT, loader.storage)
assert_last_visit_matches(loader.storage, origin_url, status="full", type="cran")
@@ -229,20 +232,10 @@
expected_snapshot_id = "920adcccc78aaeedd3cfa4459dd900d8c3431a21"
assert actual_load_status == {
"status": "eventful",
- "snapshot_id": expected_snapshot_id,
+ "snapshot_id": SNAPSHOT.id.hex(),
}
- expected_snapshot = {
- "id": hash_to_bytes(expected_snapshot_id),
- "branches": {
- b"HEAD": {"target": b"releases/2.22-6", "target_type": "alias"},
- b"releases/2.22-6": {
- "target": hash_to_bytes("42bdb16facd5140424359c8ce89a28ecfa1ce603"),
- "target_type": "revision",
- },
- },
- }
- check_snapshot(expected_snapshot, loader.storage)
+ check_snapshot(SNAPSHOT, loader.storage)
assert_last_visit_matches(loader.storage, origin_url, status="full", type="cran")
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Dec 21 2024, 8:15 AM (11 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3217136
Attached To
D3537: test_cran: Check against snapshot model object
Event Timeline
Log In to Comment