示例#1
0
def test_chat_card_template_titles(user):
    template = templates.ChatCardTemplate(user.id, 1)
    assert template.title == 'You have 1 chat with new messages'

    template = templates.ChatCardTemplate(user.id, 2)
    assert template.title == 'You have 2 chats with new messages'

    template = templates.ChatCardTemplate(user.id, 42)
    assert template.title == 'You have 42 chats with new messages'
示例#2
0
def test_chat_card_template(user):
    card_id = templates.ChatCardTemplate.get_card_id(user.id)
    assert card_id.split(':') == [user.id, 'CHAT_ACTIVITY']

    template = templates.ChatCardTemplate(user.id, 1)
    assert template.card_id == card_id
    assert template.user_id == user.id
    assert template.action == 'https://real.app/chat/'
    assert not template.only_usernames
    assert not template.post_id
    assert not template.comment_id
def chat_card_template(card_manager, user):
    template = templates.ChatCardTemplate(user.id, chats_with_unviewed_messages_count=2)
    card_manager.add_or_update_card(template)
    yield template
示例#4
0
def chat_card_template(user):
    yield templates.ChatCardTemplate(user.id,
                                     chats_with_unviewed_messages_count=2)