def test_new_question(self): answer = ['help','me'] answer.append('please') question2 = Question() question2.questionDescr ='testing_question' question2.questionType ='MCQ' question2.questionParts = answer question2.answerList = answer question2.answerList = answer question2.userId = '*****@*****.**' question2.ansPos = answer question2.put() question1 = Question.newQuestion(Question(key_name='help'),'test','MCQ',answer,answer,'*****@*****.**',answer)
def post(self): trial = json.loads(self.request.body) qn = Question() qn.questionDescr = trial['descr'] qn.questionType = trial['questionType'] questionParts = trial['qnParts'] answerLong = trial['answer'] qnPartsLong = trial['qnParts'] ansPosLong = trial['ansPos'] answer = [] qnParts = [] ansPos = [] for x in answerLong: number = x['num'] answer.append(str(number)) ans = x['ans'] answer.append(str(ans)) qn.answerList = answer for x in qnPartsLong: number = x['num'] qnParts.append(str(number)) qnss = x['qn'] qnParts.append(str(qnss)) qn.questionParts = qnParts for x in ansPosLong: number = x['num'] ansPos.append(str(number)) dir = x['dir'] ansPos.append(str(dir)) posR = x['posR'] ansPos.append(str(posR)) posC = x['posC'] ansPos.append(str(posC)) qn.ansPos = ansPos user = users.get_current_user() qn.userId = user.email() qn.put() self.response.out.write("Success")