def voteQuestion(self, question, user, vote, **kwargs): log.debug("voting question {} {} {}".format(question, user, vote)) q = Question.get(question) print q u = User.get(user) print u new_rating = q.vote(u, vote) print new_rating return new_rating
def voteAnswer(self, question, answer, user, vote, **kwargs): print "voting answer", answer, user, vote # question = Question.get(question) a = Answer.get(question_id=question, answer_id=answer) print a u = User.get(user) print u new_rating = a.vote(u, vote) return new_rating
def test_create(): user = User.create("something") assert user.user_id == "something"
def get_user(): return User.create(uuid1())
def answer(self, question, user, text, **kwargs): q = Question.get(question) u = User.get(user) answer = q.answer(user=u, text=text) return str(answer.answer_id)
def registerUser(self, user_id, **kwargs): User.create(user_id)
def ask(self, text, category, user, **kwargs): cat = Category.get(category) u = User.get(user) question = Question.create(cat, text, u) return str(question.question_id)