Eliminate all of the exceptions when running the tests.
This commit is contained in:
parent
e1b704bdac
commit
6f39e158d6
10 changed files with 50 additions and 10 deletions
|
@ -7,7 +7,7 @@ from flask.ext.principal import identity_changed, AnonymousIdentity
|
|||
|
||||
from app import app
|
||||
from endpoints.api import (ApiResource, nickname, resource, validate_json_request, request_error,
|
||||
log_action, internal_only, NotFound)
|
||||
log_action, internal_only, NotFound, Unauthorized)
|
||||
from endpoints.api.subscribe import subscribe
|
||||
from endpoints.common import common_login
|
||||
from data import model
|
||||
|
@ -122,6 +122,9 @@ class User(ApiResource):
|
|||
def put(self):
|
||||
""" Update a users details such as password or email. """
|
||||
user = get_authenticated_user()
|
||||
if not user:
|
||||
raise Unauthorized()
|
||||
|
||||
user_data = request.get_json()
|
||||
|
||||
try:
|
||||
|
@ -179,6 +182,9 @@ class PrivateRepositories(ApiResource):
|
|||
""" Get the number of private repos this user has, and whether they are allowed to create more.
|
||||
"""
|
||||
user = get_authenticated_user()
|
||||
if not user:
|
||||
raise Unauthorized()
|
||||
|
||||
private_repos = model.get_private_repo_count(user.username)
|
||||
repos_allowed = 0
|
||||
|
||||
|
@ -251,6 +257,9 @@ class ConvertToOrganization(ApiResource):
|
|||
def post(self):
|
||||
""" Convert the user to an organization. """
|
||||
user = get_authenticated_user()
|
||||
if not user:
|
||||
raise Unauthorized()
|
||||
|
||||
convert_data = request.get_json()
|
||||
|
||||
# Ensure that the new admin user is the not user being converted.
|
||||
|
|
Reference in a new issue