Use new error format for auth errors (factor exceptions into module)

This commit is contained in:
Evan Cordell 2016-04-11 16:20:11 -04:00
parent 9c08717173
commit eba75494d9
25 changed files with 214 additions and 177 deletions

View file

@ -44,7 +44,7 @@ from endpoints.api.logs import UserLogs, OrgLogs, OrgAggregateLogs, UserAggregat
from endpoints.api.billing import (UserCard, UserPlan, ListPlans, OrganizationCard,
OrganizationPlan)
from endpoints.api.discovery import DiscoveryResource
from endpoints.api.error import ApiError
from endpoints.api.error import Error
from endpoints.api.organization import (OrganizationList, OrganizationMember,
OrgPrivateRepositories, OrganizationMemberList,
Organization, ApplicationInformation,
@ -237,12 +237,12 @@ class TestDiscovery(ApiTestCase):
assert 'paths' in json
class TestError(ApiTestCase):
class TestErrorDescription(ApiTestCase):
def test_get_error(self):
json = self.getJsonResponse(APIError, data=dict(error='not_found'))
json = self.getJsonResponse(Error, params=dict(error_type='not_found'))
assert json['title'] == 'not_found'
assert type in json
assert description in json
assert 'type' in json
assert 'description' in json
class TestPlans(ApiTestCase):
@ -355,7 +355,7 @@ class TestGetUserPrivateAllowed(ApiTestCase):
assert json['privateCount'] == 0
assert not json['privateAllowed']
def test_allowedz(self):
def test_allowed(self):
self.login(ADMIN_ACCESS_USER)
# Change the subscription of the namespace.