def test_count_nb_message(self):
     """webmessage - count the number of messages"""
     delete_all_messages(5)
     # juliet writes 3 messages to romeo
     webmessage.perform_request_send(6,
                                     msg_to_user="******",
                                     msg_to_group="",
                                     msg_subject="Hi romeo",
                                     msg_body="hello romeo how are you?",
                                    ln=CFG_SITE_LANG)
     webmessage.perform_request_send(6,
                                     msg_to_user="******",
                                     msg_to_group="",
                                     msg_subject="Hi romeo",
                                     msg_body="hello romeo how are you?",
                                    ln=CFG_SITE_LANG)
     webmessage.perform_request_send(6,
                                     msg_to_user="******",
                                     msg_to_group="",
                                     msg_subject="Hi romeo",
                                     msg_body="hello romeo how are you?",
                                    ln=CFG_SITE_LANG)
     self.assertEqual(count_nb_messages(5), 3)
     delete_all_messages(5)
     self.assertEqual(count_nb_messages(5), 0)
示例#2
0
 def test_count_nb_message(self):
     """webmessage - count the number of messages"""
     delete_all_messages(5)
     # juliet writes 3 messages to romeo
     webmessage.perform_request_send(6,
                                     msg_to_user="******",
                                     msg_to_group="",
                                     msg_subject="Hi romeo",
                                     msg_body="hello romeo how are you?",
                                    ln=CFG_SITE_LANG)
     webmessage.perform_request_send(6,
                                     msg_to_user="******",
                                     msg_to_group="",
                                     msg_subject="Hi romeo",
                                     msg_body="hello romeo how are you?",
                                    ln=CFG_SITE_LANG)
     webmessage.perform_request_send(6,
                                     msg_to_user="******",
                                     msg_to_group="",
                                     msg_subject="Hi romeo",
                                     msg_body="hello romeo how are you?",
                                    ln=CFG_SITE_LANG)
     self.assertEqual(count_nb_messages(5), 3)
     delete_all_messages(5)
     self.assertEqual(count_nb_messages(5), 0)
示例#3
0
def perform_request_display(uid,
                            errors=[],
                            warnings=[],
                            infos=[],
                            ln=CFG_SITE_LANG):
    """
    Displays the user's Inbox
    @param uid:   user id

    @return: a (body, [errors], [warnings]) formed tuple
    """
    body = ""
    rows = []
    rows = db.get_all_messages_for_user(uid)
    nb_messages = db.count_nb_messages(uid)
    no_quota_users = list_users_in_roles(CFG_WEBMESSAGE_ROLES_WITHOUT_QUOTA)
    no_quota = False
    if uid in no_quota_users:
        no_quota = True
    body = webmessage_templates.tmpl_display_inbox(messages=rows,
                                                   infos=infos,
                                                   warnings=warnings,
                                                   nb_messages=nb_messages,
                                                   no_quota=no_quota,
                                                   ln=ln)
    return (body, errors, warnings)
 def test_delete_message_from_user_inbox(self):
     """webmessage - delete message from user inbox"""
     delete_all_messages(5)
     # juliet writes a message to romeo
     webmessage.perform_request_send(6,
                                     msg_to_user="******",
                                     msg_to_group="",
                                     msg_subject="Hi romeo",
                                     msg_body="hello romeo how are you?",
                                    ln=CFG_SITE_LANG)
     msg_id = get_all_messages_for_user(5)[0][0]
     delete_message_from_user_inbox(5, msg_id)
     self.assertEqual(count_nb_messages(5), 0)
示例#5
0
 def test_delete_message_from_user_inbox(self):
     """webmessage - delete message from user inbox"""
     delete_all_messages(5)
     # juliet writes a message to romeo
     webmessage.perform_request_send(6,
                                     msg_to_user="******",
                                     msg_to_group="",
                                     msg_subject="Hi romeo",
                                     msg_body="hello romeo how are you?",
                                    ln=CFG_SITE_LANG)
     msg_id = get_all_messages_for_user(5)[0][0]
     delete_message_from_user_inbox(5, msg_id)
     self.assertEqual(count_nb_messages(5), 0)
示例#6
0
def perform_request_display(uid, warnings=[], infos=[], ln=CFG_SITE_LANG):
    """
    Displays the user's Inbox
    @param uid:   user id

    @return: body with warnings
    """
    body = ""
    rows = []
    rows = db.get_all_messages_for_user(uid)
    nb_messages = db.count_nb_messages(uid)
    no_quota_users = list_users_in_roles(CFG_WEBMESSAGE_ROLES_WITHOUT_QUOTA)
    no_quota = False
    if uid in no_quota_users:
        no_quota = True
    body = webmessage_templates.tmpl_display_inbox(messages=rows,
                                                   infos=infos,
                                                   warnings=warnings,
                                                   nb_messages=nb_messages,
                                                   no_quota=no_quota,
                                                   ln=ln)
    return body