Exemplo n.º 1
0
def test_list_messages_all(database):
    user_hash_1 = User.create_user(2, 2, "Test user 1", database)
    user_hash_2 = User.create_user(3, 3, "Test user 2", database)
    assert len(Message.inspect_all_messages(user_hash_1, database)) == 0
    assert len(Message.inspect_all_messages(user_hash_2, database)) == 0
    Message.create_message(user_hash_1, user_hash_2, "HELLO", database)
    assert len(Message.inspect_all_messages(user_hash_1, database)) == 1
    assert len(Message.inspect_all_messages(user_hash_2, database)) == 1
Exemplo n.º 2
0
 def inspect_all_messages(self, user_hash=None):
     self.user_validation()
     if user_hash is None:
         user_hash = self.user.character_hash
     messages = Message.inspect_all_messages(user_hash, self.database)
     resulting_data = ""
     for message in messages:
         resulting_data += str(message) + '\n'
     if not messages:
         resulting_data = NO_MESSAGES_FOUND
     return resulting_data