Exemplo n.º 1
0
    def test_add_question(self):
        params = {"question": "question text",
                  "correct": "correct text",
                  "wrong1": "wrong option #1",
                  "wrong2": "wrong option #2",
                  "wrong3": "wrong option #3"}
        add_question_url = "/add_question?" + urllib.urlencode(params)

        response = self.client.get(add_question_url)
        self.assertTrue(response.json["ok"])

        question_doc = db.question_from_oid(ObjectId(response.json["question_oid"]))
        for key, value in params.items():
            self.assertEquals(value, question_doc[key])
Exemplo n.º 2
0
 def from_oid(question_oid):
     return Question.from_doc(db.question_from_oid(question_oid))