Exemplo n.º 1
0
def create_snip(message, conv):
    assert 'body' in dir(message), "Expecting a MailRequest"
    text = scrape_response(message.body())
    snip = Snip(prompt=text, 
                conversation=conv,
                sequence=get_snip_sequence(conv),
                complete=False)
    snip.save()
    return snip
Exemplo n.º 2
0
def test_build_moderation_request_message_body():
    u = User()
    u.save()
    
    c = Conversation(user=u)
    c.save()
    
    s1 = Snip(conversation=c,prompt='Hello Mr. Quibbles',sequence=0,complete=True)
    s1.save()
    
    a1 = Answer(snip=s1,text='Hello User.')
    a1.save()
    
    m1 = Moderated(snip=s1,text='moderated Hello User.')
    m1.save()
    
    s2 = Snip(conversation=c,prompt='Are you people?',sequence=1)
    s2.save()
    
    a2 = Answer(snip=s2,text='Skynet is people.')
    a2.save()
    a3 = Answer(snip=s2,text='I am Skynet.')
    a3.save()
    
    moderation_request_message = build_mod_request_message_body(s2)
Exemplo n.º 3
0
def test_get_answer_message():
    u = User()
    u.save()
    
    c = Conversation(user=u)
    c.save()
    
    s1 = Snip(conversation=c,prompt='Hello Mr. Quibbles',sequence=0,complete=True)
    s1.save()
    
    a1 = Answer(snip=s1,text='Hello User.')
    a1.save()
    
    m1 = Moderated(snip=s1,text='moderated Hello User.')
    m1.save()
    
    s2 = Snip(conversation=c,prompt='Are you people?',sequence=1)
    s2.save()
    
    a2 = Answer(snip=s2)
    a2.save()

    answer_message = get_answer_message(a2)