def testGetEmail(self): import emission.net.api.bottle as enab import io user_data = io.StringIO() test_email = "correct_horse_battery_staple" user_data.write(json.dumps({'user': test_email})) test_environ = etc.createDummyRequestEnviron(self, addl_headers=None, request_body=user_data) request = enab.LocalRequest(environ=test_environ) logging.debug("Found request body = %s" % request.body.getvalue()) logging.debug("Found request headers = %s" % list(request.headers.keys())) self.assertEqual(enaa._getEmail(request, "skip", inHeader=False), test_email) self.assertEqual(enaa._getEmail(request, "token_list", inHeader=False), test_email)
def testGetEmail(self): import emission.net.api.bottle as enab import io user_data = io.StringIO() test_email = "correct_horse_battery_staple" user_data.write(json.dumps({'user': test_email})) test_environ = etc.createDummyRequestEnviron(self, addl_headers=None, request_body=user_data) request = enab.LocalRequest(environ=test_environ) logging.debug("Found request body = %s" % request.body.getvalue()) logging.debug("Found request headers = %s" % list(request.headers.keys())) self.assertEqual(enaa._getEmail(request, "skip", inHeader=False), test_email) self.assertEqual(enaa._getEmail(request, "token_list", inHeader=False), test_email)
def createUserProfile(): try: logging.debug("Called createUserProfile") userEmail = enaa._getEmail(request, auth_method) logging.debug("userEmail = %s" % userEmail) user = User.register(userEmail) logging.debug("Looked up user = %s" % user) logging.debug("Returning result %s" % {'uuid': str(user.uuid)}) return {'uuid': str(user.uuid)} except ValueError as e: traceback.print_exc() abort(403, e.message)
def createUserProfile(): try: logging.debug("Called createUserProfile") userEmail = enaa._getEmail(request, auth_method) logging.debug("userEmail = %s" % userEmail) user = User.register(userEmail) logging.debug("Looked up user = %s" % user) logging.debug("Returning result %s" % {'uuid': str(user.uuid)}) return {'uuid': str(user.uuid)} except ValueError as e: traceback.print_exc() abort(403, e.message)