Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/common/test_utils.py
Show All 29 Lines | |||||
def test_shorten_path_sha1(): | def test_shorten_path_sha1(): | ||||
sha1 = "aafb16d69fd30ff58afdd69036a26047f3aebdc6" | sha1 = "aafb16d69fd30ff58afdd69036a26047f3aebdc6" | ||||
short_sha1 = sha1[:8] + "..." | short_sha1 = sha1[:8] + "..." | ||||
templates = [ | templates = [ | ||||
"/api/1/content/sha1:%s/", | "/api/1/content/sha1:%s/", | ||||
"/api/1/content/sha1_git:%s/", | "/api/1/content/sha1_git:%s/", | ||||
"/api/1/directory/%s/", | "/api/1/directory/%s/", | ||||
"/api/1/content/sha1:%s/ctags/", | |||||
] | ] | ||||
for template in templates: | for template in templates: | ||||
assert utils.shorten_path(template % sha1) == template % short_sha1 | assert utils.shorten_path(template % sha1) == template % short_sha1 | ||||
def test_shorten_path_sha256(): | def test_shorten_path_sha256(): | ||||
sha256 = "aafb16d69fd30ff58afdd69036a26047" "213add102934013a014dfca031c41aef" | sha256 = "aafb16d69fd30ff58afdd69036a26047" "213add102934013a014dfca031c41aef" | ||||
▲ Show 20 Lines • Show All 347 Lines • Show Last 20 Lines |