示例#1
0
  def test_insertsResponseIntoTable(self):
    oldCount = self.db.countResponses()

    resp = Response()
    resp.recog = "True"
    resp.comp = "Composer"
    resp.comp_conf = "5"
    resp.piece = "Piece"
    resp.piece_conf = "3"
    resp.name = "Name"
    resp.age = "23"

    self.db.saveResponse(resp)

    newCount = self.db.countResponses()
    newResponses = newCount - oldCount

    self.assertEquals(newResponses, 1)
示例#2
0
def item2():
    # print 'this is a post item'
    # initialize in case no answer

    response = Response()

    response.order = app.order[app.num - 1]
    response.recog = request.form["recog"]
    response.comp = request.form["comp"]
    response.comp_conf = request.form["comp_conf"]
    response.piece = request.form["piece"]
    response.piece_conf = request.form["piece_conf"]
    response.name = app.progvars["name"]
    response.age = app.progvars["age"]

    db.saveResponse(response)

    return redirect(url_for("main"))