Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
super(AppTestCase, self).setUp()
self.app = klein.Klein()
self.kr = KleinResource(self.app)
@self.app.route("/")
@self.auth.token_required
def token_required_endpoint(request, userinfo):
return userinfo
self.token_required_endpoint = token_required_endpoint
@self.app.route("/api/")
@self.auth.match_required
def match_required_endpoint(request, userinfo, email):
logger.debug("in endpoint: request={!r}, userinfo={!r}, email={!r}", request, userinfo, email)
return json.dumps(userinfo)
self.match_required_endpoint = match_required_endpoint
def resource(self):
"""
Return an L{IResource} which suitably wraps this app.
@returns: An L{IResource}
"""
return KleinResource(self)
def resource(self):
"""
Return an L{IResource} which suitably wraps this app.
@returns: An L{IResource}
"""
return KleinResource(self)