コード例 #1
0
ファイル: conversation.py プロジェクト: rgovoni/ZebraSHARK
def get_conversations_hardcoded():
    password = "******"
    hash = md5(password).hexdigest()
    user_one = User.get_by(email_address="*****@*****.**") or \
               User(email_address="*****@*****.**", name="Bob", hash=hash)
    user_two = User.get_by(email_address="*****@*****.**") or \
               User(email_address="*****@*****.**", name="Jane", hash=hash)
    entries = [
        ConversationEntry(user=user_one, text="KILL ALL UNICORNS!!!1111", time=datetime.now()),
        ConversationEntry(user=user_two, text="NNNooooooooooo", time=datetime.now())
    ]
    participants = [
        ConversationParticipant(user=user_one, stance="KILL ALL UNICORNS"),
        ConversationParticipant(user=user_two, stance="SAVE THE UNICORNS"),
    ]
    question_text = "Should unicorn hunting be outlawed?"
    question = Question.get_by(text=question_text) or Question(text=question_text, topic="Conservation")
    conversation = Conversation(
        votes=[],
        entries=entries,
        participaints=participants,
        question=question)
    return flask.jsonify({"conversations": [conversation.to_json()]}), 200