Add tufmetadata endpoint

This commit is contained in:
Evan Cordell 2017-04-05 10:03:27 -04:00
parent 1bfca871ec
commit 9515f18fb6
9 changed files with 282 additions and 1 deletions

View file

@ -74,6 +74,7 @@ from endpoints.api.superuser import (SuperUserLogs, SuperUserList, SuperUserMana
SuperUserCustomCertificates, SuperUserCustomCertificate)
from endpoints.api.globalmessages import (GlobalUserMessage, GlobalUserMessages,)
from endpoints.api.secscan import RepositoryImageSecurity, RepositoryManifestSecurity
from endpoints.api.signing import RepositorySignatures
from endpoints.api.suconfig import (SuperUserRegistryStatus, SuperUserConfig, SuperUserConfigFile,
SuperUserCreateInitialSuperUser)
from endpoints.api.manifest import RepositoryManifestLabels, ManageRepositoryManifestLabel
@ -4506,6 +4507,31 @@ class TestRepositoryImageSecurity(ApiTestCase):
expected_code=200)
class TestRepositorySignatures(ApiTestCase):
def test_get_signatures(self):
self.login(ADMIN_ACCESS_USER)
targets = {
'latest': {
'hashes': {
'sha256': 'mLmxwTyUrqIRDaz8uaBapfrp3GPERfsDg2kiMujlteo='
},
'length': 1500
},
'test_tag': {
'hashes': {
'sha256': '1234123'
},
'length': 50
}
}
with patch('app.tuf_metadata_api') as mock_tuf:
mock_tuf.get_default_tags.return_value = targets
signed_tags_response = self.getJsonResponse(RepositorySignatures, params=dict(namespace='ns', repository='repo'))
self.assertEquals(signed_tags_response, {'tags': ['latest', 'test_tag']})
class TestSuperUserCustomCertificates(ApiTestCase):
def test_custom_certificates(self):
self.login(ADMIN_ACCESS_USER)