fix strip_sha256
This commit is contained in:
parent
4a64ddc86e
commit
22c1a29892
2 changed files with 13 additions and 1 deletions
|
@ -429,6 +429,9 @@ class OCIAppModel(AppRegistryDataInterface):
|
||||||
|
|
||||||
|
|
||||||
def _strip_sha256_header(digest):
|
def _strip_sha256_header(digest):
|
||||||
return digest.lstrip('sha256:')
|
if digest.startswith('sha256:'):
|
||||||
|
return digest.split('sha256:')[1]
|
||||||
|
return digest
|
||||||
|
|
||||||
|
|
||||||
oci_app_model = OCIAppModel()
|
oci_app_model = OCIAppModel()
|
||||||
|
|
9
data/interfaces/test/test_appr.py
Normal file
9
data/interfaces/test/test_appr.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import pytest
|
||||||
|
from data.interfaces.appr import _strip_sha256_header
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('digest,expected', [
|
||||||
|
('sha256:251b6897608fb18b8a91ac9abac686e2e95245d5a041f2d1e78fe7a815e6480a', '251b6897608fb18b8a91ac9abac686e2e95245d5a041f2d1e78fe7a815e6480a'),
|
||||||
|
('251b6897608fb18b8a91ac9abac686e2e95245d5a041f2d1e78fe7a815e6480a', '251b6897608fb18b8a91ac9abac686e2e95245d5a041f2d1e78fe7a815e6480a'),])
|
||||||
|
def test_stip_sha256(digest, expected):
|
||||||
|
assert _strip_sha256_header(digest) == expected
|
Reference in a new issue