Add a test to verify that all important blueprints have all their methods decorated

This ensures that we don't accidentally add a blueprint method without either explicitly blacklisting or whitelisting anonymous access
This commit is contained in:
Joseph Schorr 2015-06-02 15:56:44 -04:00
parent 075c75d031
commit 477a3fdcdc
6 changed files with 57 additions and 4 deletions

View file

@ -19,7 +19,7 @@ from auth import scopes
from auth.auth_context import get_authenticated_user, get_validated_oauth_token
from auth.auth import process_oauth
from endpoints.csrf import csrf_protect
from endpoints.decorators import anon_protect
from endpoints.decorators import check_anon_protection
logger = logging.getLogger(__name__)
@ -229,14 +229,14 @@ def parse_repository_name(func):
class ApiResource(Resource):
method_decorators = [anon_protect]
method_decorators = [check_anon_protection]
def options(self):
return None, 200
class RepositoryParamResource(ApiResource):
method_decorators = [anon_protect, parse_repository_name]
method_decorators = [check_anon_protection, parse_repository_name]
def require_repo_permission(permission_class, scope, allow_public=False):