def test_create_user(self, mock_api_call, mock_get_db, mock_post, body=body): create_user(body) user = get_user_by_id(body['id']) body['profile_picture_url'] = 'generic' body['profile_pictures_id'] = user['profile_pictures_id'] body['cover_pictures_id'] = user['cover_pictures_id'] self.assertEquals(get_user_by_id(body['id']), body)
def make_user(current_user, app_name): data = request.get_json() new_user = create_user(app_name, data['name'], data['password']) if new_user != False: return jsonify({"message": "User created", "id": new_user}) else: return jsonify({ "message": "Database denied connection/User already exists", "Error": "401" })
def test_func_create_user_stores_user_info(self): from app import Request, create_user test_user = Request( username='******', profile='kittens' ) result = create_user(test_user) assert result == EXPECTED_MESSAGE
from app import create_app, create_user import optparse from config import * app = create_app(None) if __name__ == '__main__': parser = optparse.OptionParser() parser.add_option("-u", "--User", dest="user", help="User to add", default=None) parser.add_option("-p", "--Password", dest="password", help="Stations file to import.", default=None) (options, args) = parser.parse_args() if (options.user is not None): if (options.password is not None): create_user(options.user, options.password) else: print("Must provide password") else: #install_secret_key(app, SECRET_KEY_FILE) app.run(debug=True) app.logger.debug("App started")
def create_user(self): return app.create_user("ema", "Emanuele", "Rocca", "*****@*****.**", "VU University Amsterdam", "properpass", 120)
""" ConPaaS director: add user """ import sys import app if __name__ == "__main__": app.db.create_all() try: email, username, password = sys.argv[1:] app.create_user(username, "", "", email, "", password, 120) except ValueError: print "Usage: %s email username password" % sys.argv[0]