def addRecord(): if request.method == 'POST': # read in the post request name = request.form['name'] address = request.form['address'] city = request.form['city'] email = request.form['email'] databaseReponseMessage = databaseOps.addDatabaseEntry(name, address, city, email) return render_template("result.html",msg = databaseReponseMessage)
def run(): # Script for simulating user interaction try: databaseOps.intialDatabaseCreation() except: pass username = "******" password = "******" FirstName = "Kate" LastName = "Newman" PhoneNumber = "928353461" Address = "1789 S Failing Finals ST Flagstaff AZ 86001" Email = "*****@*****.**" qrStirng = f"Name: {FirstName} {LastName} \nPhoneNumber: {PhoneNumber}\nAddress: {Address}\nEmail: {Email}" userID = databaseOps.getUserID(username) accountBackEnd.add_account_to_data_base(username, password) databaseOps.addDatabaseEntry(userID, FirstName, LastName, PhoneNumber, Address, Email) databaseOps.addQrDataEntry(userID, username, qrStirng)
def addRecord(): if "user" in session: user = session["user"] if request.method == 'POST': firstName = request.form['firstName'] lastName = request.form['lastName'] phoneNumber = request.form['phone'] address = request.form['address'] email = request.form['email'] userid = getUserId(user) # call to back end db manager to add data databaseReponseMessage = databaseOps.addDatabaseEntry(userid, firstName, lastName, address, phoneNumber, email) print(databaseReponseMessage) return redirect(url_for('home')) else: return redirect(url_for('log_in'))
def test_addDatabaseEntry(): assert databaseOps.addDatabaseEntry( 123, "Fname", "Lname", 123 - 456 - 7891, "123 W Test St", "*****@*****.**") == "Record successfully added"