Example #1
0
from mongoengine import *
from app import User, Question, Attempt

client = connect("psle_test")

# remove ALL the users in the database
User.drop_collection()
Question.drop_collection()
Attempt.drop_collection()

# create users
u1 = User(name="Joshua", email="*****@*****.**", password="******")
u1.save()
u2 = User(name="Isaac", email="*****@*****.**", password="******")
u2.save()
u3 = User(name="Cow", email="*****@*****.**", password="******")
u3.save()
u4 = User(name="moo", email="*****@*****.**", password="******")
u4.save()
# # create questions
q1 = Question(text="Joshua went the the market to buy ___head biscuits",
              options=["went", "arrow", "sheep", "cow"],
              answer=4,
              credit="oxcow university")
q1.save()
q2 = Question(text="Joshua and Isaac were eating ___head biscuits ",
              options=["cow", "arrow", "went", "sheep"],
              answer=1,
              credit="cowbridge university")
q2.save()
q3 = Question(text="Isaac exclamed that ___head biscuits were his favourite",