diff --git a/endpoints/appr/test/test_api.py b/endpoints/appr/test/test_api.py index 74311d09f..191a4161d 100644 --- a/endpoints/appr/test/test_api.py +++ b/endpoints/appr/test/test_api.py @@ -14,6 +14,7 @@ from app import app as application from data.database import close_db_filter, User, db as database from data.model import user, organization from data.interfaces.appr import oci_app_model +import data.oci_model.blob as oci_blob from endpoints.appr import appr_bp, registry from endpoints.appr.cnr_backend import QuayDB, Channel, Package from initdb import wipe_database, initialize_database, populate_database @@ -203,3 +204,17 @@ class TestQuayModels(CnrTestModels): def test_db_restore(self, newdb, dbdata1): # This will fail as long as CNR tests use a mediatype with v1. pass + + def test_push_same_blob(self, db_with_data1): + p = db_with_data1.Package.get("titi/rocketchat", ">1.2", 'kpm') + assert p.package == "titi/rocketchat" + assert p.release == "2.0.1" + assert p.digest == "d3b54b7912fe770a61b59ab612a442eac52a8a5d8d05dbe92bf8f212d68aaa80" + blob = db_with_data1.Blob.get("titi/rocketchat", + p.digest) + bdb = oci_blob.get_blob(p.digest) + newblob = db_with_data1.Blob("titi/app2", blob.b64blob) + p2 = db_with_data1.Package("titi/app2", "1.0.0", "helm", newblob) + p2.save() + b2db = oci_blob.get_blob(p2.digest) + assert b2db.id == bdb.id