Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/common/test_archive.py
Show First 20 Lines • Show All 969 Lines • ▼ Show 20 Lines | |||||
def test_lookup_origin_missing_trailing_slash(archive_data): | def test_lookup_origin_missing_trailing_slash(archive_data): | ||||
deb_origin = Origin(url="http://snapshot.debian.org/package/r-base/") | deb_origin = Origin(url="http://snapshot.debian.org/package/r-base/") | ||||
archive_data.origin_add([deb_origin]) | archive_data.origin_add([deb_origin]) | ||||
origin_info = archive.lookup_origin({"url": deb_origin.url[:-1]}) | origin_info = archive.lookup_origin({"url": deb_origin.url[:-1]}) | ||||
assert origin_info["url"] == deb_origin.url | assert origin_info["url"] == deb_origin.url | ||||
def test_lookup_origin_single_slash_after_protocol(archive_data): | |||||
origin_url = "http://snapshot.debian.org/package/r-base/" | |||||
malformed_origin_url = "http:/snapshot.debian.org/package/r-base/" | |||||
archive_data.origin_add([Origin(url=origin_url)]) | |||||
origin_info = archive.lookup_origin({"url": malformed_origin_url}) | |||||
ardumont: Maybe add some other checks on urls which contains swhid with context in there.
afaiu, this… | |||||
Not Done Inline Actionsaddressed by the new test_resolve_swhid_with_malformed_origin_url below. ardumont: addressed by the new test_resolve_swhid_with_malformed_origin_url below. | |||||
assert origin_info["url"] == origin_url | |||||
@given(snapshot()) | @given(snapshot()) | ||||
def test_lookup_snapshot_branch_name_from_tip_revision(archive_data, snapshot_id): | def test_lookup_snapshot_branch_name_from_tip_revision(archive_data, snapshot_id): | ||||
snapshot = archive_data.snapshot_get(snapshot_id) | snapshot = archive_data.snapshot_get(snapshot_id) | ||||
branches = [ | branches = [ | ||||
{"name": k, "revision": v["target"]} | {"name": k, "revision": v["target"]} | ||||
for k, v in snapshot["branches"].items() | for k, v in snapshot["branches"].items() | ||||
if v["target_type"] == "revision" | if v["target_type"] == "revision" | ||||
] | ] | ||||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |
Maybe add some other checks on urls which contains swhid with context in there.
afaiu, this will replace all mispatterns, might as well make that explicit in that test.