1616 ArtifactTagOrder ,
1717 ContainerRegistryClient ,
1818)
19- from azure .containerregistry ._helpers import _deserialize_manifest
19+ from azure .containerregistry ._helpers import _deserialize_manifest , _serialize_manifest
2020from azure .core .exceptions import ResourceNotFoundError , ClientAuthenticationError
2121from azure .core .paging import ItemPaged
2222from azure .identity import AzureAuthorityHosts
@@ -461,7 +461,6 @@ def test_upload_oci_manifest(self, containerregistry_endpoint):
461461
462462 # Assert
463463 response = client .download_manifest (repo , digest )
464- assert response .digest == digest
465464 assert response .data .tell () == 0
466465 self .assert_manifest (response .manifest , manifest )
467466
@@ -472,9 +471,8 @@ def test_upload_oci_manifest(self, containerregistry_endpoint):
472471 @recorded_by_proxy
473472 def test_upload_oci_manifest_stream (self , containerregistry_endpoint ):
474473 repo = self .get_resource_name ("repo" )
475- base_path = os .path .join (self .get_test_directory (), "data" , "oci_artifact" )
476- manifest_stream = open (os .path .join (base_path , "manifest.json" ), "rb" )
477- manifest = _deserialize_manifest (manifest_stream )
474+ manifest = self .create_oci_manifest ()
475+ manifest_stream = _serialize_manifest (manifest )
478476 with self .create_registry_client (containerregistry_endpoint ) as client :
479477 self .upload_manifest_prerequisites (repo , client )
480478
@@ -483,7 +481,6 @@ def test_upload_oci_manifest_stream(self, containerregistry_endpoint):
483481
484482 # Assert
485483 response = client .download_manifest (repo , digest )
486- assert response .digest == digest
487484 assert response .data .tell () == 0
488485 self .assert_manifest (response .manifest , manifest )
489486
@@ -494,18 +491,16 @@ def test_upload_oci_manifest_stream(self, containerregistry_endpoint):
494491 @recorded_by_proxy
495492 def test_upload_oci_manifest_with_tag (self , containerregistry_endpoint ):
496493 repo = self .get_resource_name ("repo" )
494+ tag = "v1"
497495 manifest = self .create_oci_manifest ()
498496 with self .create_registry_client (containerregistry_endpoint ) as client :
499- tag = "v1"
500-
501497 self .upload_manifest_prerequisites (repo , client )
502498
503499 # Act
504500 digest = client .upload_manifest (repo , manifest , tag = tag )
505501
506502 # Assert
507503 response = client .download_manifest (repo , digest )
508- assert response .digest == digest
509504 assert response .data .tell () == 0
510505 self .assert_manifest (response .manifest , manifest )
511506
@@ -525,20 +520,17 @@ def test_upload_oci_manifest_with_tag(self, containerregistry_endpoint):
525520 @recorded_by_proxy
526521 def test_upload_oci_manifest_stream_with_tag (self , containerregistry_endpoint ):
527522 repo = self .get_resource_name ("repo" )
528- base_path = os . path . join ( self . get_test_directory (), "data" , "oci_artifact" )
529- manifest_stream = open ( os . path . join ( base_path , "manifest.json" ), "rb" )
530- manifest = _deserialize_manifest ( manifest_stream )
523+ tag = "v1"
524+ manifest = self . create_oci_manifest ( )
525+ manifest_stream = _serialize_manifest ( manifest )
531526 with self .create_registry_client (containerregistry_endpoint ) as client :
532- tag = "v1"
533-
534527 self .upload_manifest_prerequisites (repo , client )
535528
536529 # Act
537530 digest = client .upload_manifest (repo , manifest_stream , tag = tag )
538531
539532 # Assert
540533 response = client .download_manifest (repo , digest )
541- assert response .digest == digest
542534 assert response .data .tell () == 0
543535 self .assert_manifest (response .manifest , manifest )
544536
0 commit comments