Fix verbs in manifestlist
All registry_tests now pass
This commit is contained in:
parent
783c9e7a73
commit
3c8b87e086
18 changed files with 517 additions and 247 deletions
|
@ -1,8 +1,7 @@
|
|||
from collections import namedtuple
|
||||
|
||||
from app import app, storage as store
|
||||
from data import model
|
||||
from data.model import db_transaction
|
||||
from collections import namedtuple
|
||||
from util.morecollections import AttrDict
|
||||
|
||||
|
||||
|
@ -13,19 +12,6 @@ class Repository(namedtuple('Repository', ['id', 'name', 'namespace_name', 'desc
|
|||
"""
|
||||
|
||||
|
||||
def _repository_for_repo(repo):
|
||||
"""
|
||||
Returns a Repository object representing the repo data model instance given.
|
||||
"""
|
||||
return Repository(
|
||||
id=repo.id,
|
||||
name=repo.name,
|
||||
namespace_name=repo.namespace_user.username,
|
||||
description=repo.description,
|
||||
is_public=model.repository.is_repository_public(repo)
|
||||
)
|
||||
|
||||
|
||||
class DockerRegistryV1DataInterface(object):
|
||||
"""
|
||||
Interface that represents all data store interactions required by a Docker Registry v1.
|
||||
|
@ -409,12 +395,23 @@ class PreOCIModel(DockerRegistryV1DataInterface):
|
|||
def change_user_password(cls, user, new_password):
|
||||
model.user.change_password(user, new_password)
|
||||
|
||||
@classmethod
|
||||
def _repository_for_repo(cls, repo):
|
||||
""" Returns a Repository object representing the repo data model instance given. """
|
||||
return Repository(
|
||||
id=repo.id,
|
||||
name=repo.name,
|
||||
namespace_name=repo.namespace_user.username,
|
||||
description=repo.description,
|
||||
is_public=model.repository.is_repository_public(repo)
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def get_repository(cls, namespace_name, repo_name):
|
||||
repo = model.repository.get_repository(namespace_name, repo_name)
|
||||
if repo is None:
|
||||
return None
|
||||
return _repository_for_repo(repo)
|
||||
return cls._repository_for_repo(repo)
|
||||
|
||||
@classmethod
|
||||
def create_repository(cls, namespace_name, repo_name, user=None):
|
||||
|
@ -432,4 +429,4 @@ class PreOCIModel(DockerRegistryV1DataInterface):
|
|||
def get_sorted_matching_repositories(cls, search_term, only_public, can_read, limit):
|
||||
repos = model.repository.get_sorted_matching_repositories(search_term, only_public, can_read,
|
||||
limit=limit)
|
||||
return [_repository_for_repo(repo) for repo in repos]
|
||||
return [cls._repository_for_repo(repo) for repo in repos]
|
||||
|
|
Reference in a new issue