refactor(util/tufmetadata/test): move app test to gc suite

This commit is contained in:
EvB 2017-07-07 13:44:35 -04:00
parent 2a20807e8a
commit ccca0c9655
2 changed files with 8 additions and 11 deletions

View file

@ -613,3 +613,10 @@ def test_images_shared_cas_with_new_blob_table(default_tag_policy, initialized_d
# Ensure the CAS path still exists, as it is referenced by the Blob table
assert storage.exists({preferred}, storage.blob_path(digest))
def test_purge_repo(app):
""" Test that app registers delete_metadata function on repository deletions """
with patch('app.tuf_metadata_api') as mock_tuf:
model.repository.purge_repository("ns", "repo")
assert mock_tuf.delete_metadata.called_with("ns", "repo")

View file

@ -7,7 +7,6 @@ from flask import Flask
from test import testconfig
from test.fixtures import init_db_path
from util.tufmetadata import api
from data import model
valid_response = {
@ -247,12 +246,3 @@ def test_delete_metadata_exception(response_code, exception):
tuf_api = api.TUFMetadataAPI(app, app.config, client=client)
response = tuf_api.delete_metadata('quay', 'quay')
assert response == False
def test_purge_repo(init_db_path):
app = Flask(__name__)
app.config.from_object(testconfig.TestConfig())
app.config["DB_URI"] = init_db_path
with patch('app.tuf_metadata_api') as mock_tuf:
model.repository.purge_repository("ns", "repo")
assert mock_tuf.delete_metadata.called_with("ns", "repo")