Add repo purge callbacks and register TUF metadata deletion as one
This commit is contained in:
parent
883692345b
commit
ec63e495fc
5 changed files with 23 additions and 4 deletions
|
@ -1,11 +1,14 @@
|
|||
import pytest
|
||||
import requests
|
||||
from mock import mock
|
||||
from mock import mock,patch
|
||||
|
||||
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 = {
|
||||
'signed' : {
|
||||
|
@ -121,3 +124,12 @@ 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")
|
Reference in a new issue