Add a lookup test for get_or_create_shared_blob

This commit is contained in:
Joseph Schorr 2019-02-14 10:27:34 -05:00
parent f917de8c70
commit ec35750f2c

View file

@ -1,3 +1,4 @@
from app import storage
from data import model, database
from test.fixtures import *
@ -30,3 +31,11 @@ def test_store_blob(initialized_db):
assert blob_storage3.id != blob_storage.id
assert blob_storage3.image_size == 1234
assert blob_storage3.uncompressed_size == 5678
def test_get_or_create_shared_blob(initialized_db):
shared = model.blob.get_or_create_shared_blob('sha256:abcdef', 'somecontent', storage)
assert shared.content_checksum == 'sha256:abcdef'
again = model.blob.get_or_create_shared_blob('sha256:abcdef', 'somecontent', storage)
assert shared == again