Пример #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
Пример #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
Пример #3
0
def test_create():
    user = User.create("something")
    assert user.user_id == "something"
Пример #4
0
def get_user():
    return User.create(uuid1())
Пример #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)
Пример #6
0
 def registerUser(self, user_id, **kwargs):
     User.create(user_id)
Пример #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)
Пример #8
0
def test_create():
    user = User.create("something")
    assert user.user_id == "something"