Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
def test_create():
    user = User.create("something")
    assert user.user_id == "something"
Exemplo n.º 4
0
def get_user():
    return User.create(uuid1())
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
 def registerUser(self, user_id, **kwargs):
     User.create(user_id)
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
def test_create():
    user = User.create("something")
    assert user.user_id == "something"