예제 #1
0
from yunity.conversations.models import ConversationMessage, ConversationType, Conversation
from yunity.utils.tests.mock import MockUser

users = MockUser.create_batch(5)
request_user = users[0]
initial_users = users[1:]

chat = Conversation.objects.create(type=ConversationType.USER_MULTICHAT)
chat.participants.add(*initial_users)

ConversationMessage.objects.create(
    content="Hello group chat!",
    sent_by=initial_users[0],
    in_conversation=chat
)
예제 #2
0
from yunity.models import Chat, Message
from yunity.utils.tests.mock import MockUser

users = MockUser.create_batch(3)
request_user = users[0]

chat1 = Chat.objects.create()
chat1.participants.add(*users)
chat1.name = "My little group chat"
chat1.save()

Message.objects.create(
    content="Hey, I created a group chat",
    type="TEXT",
    sent_by=users[0],
    in_conversation=chat1
)

Message.objects.create(
    content="Thanks, how are you two?",
    type="TEXT",
    sent_by=users[1],
    in_conversation=chat1
)

chat2 = Chat.objects.create()
chat2.participants.add(users[0], users[1])

Message.objects.create(
    content="Hello user 1",
    type="TEXT",
예제 #3
0
from yunity.conversations.models import ConversationMessage, Conversation
from yunity.utils.tests.mock import MockUser

chat_starter, chat_responder = MockUser.create_batch(2)

chat = Conversation.objects.create()
chat.participants.add(chat_starter, chat_responder)

ConversationMessage.objects.create(content="Hey, I created a chat",
                                   sent_by=chat_starter,
                                   in_conversation=chat)
예제 #4
0
from yunity.models import Chat, Message
from yunity.utils.tests.mock import MockUser

chat_starter, chat_responder = MockUser.create_batch(2)

chat = Chat.objects.create()
chat.participants.add(chat_starter, chat_responder)

Message.objects.create(
    content="Hey, I created a chat",
    type="TEXT",
    sent_by=chat_starter,
    in_conversation=chat
)
예제 #5
0
from yunity.models import Chat, Message
from yunity.utils.tests.mock import MockUser

chat_starter, request_user = MockUser.create_batch(2)

chat = Chat.objects.create()
chat.participants.add(chat_starter)

Message.objects.create(content="Hey, I created a chat",
                       type="TEXT",
                       sent_by=chat_starter,
                       in_conversation=chat)
예제 #6
0
from yunity.utils.tests.mock import MockUser

request_user = MockUser.create()
add_users = MockUser.create_batch(2)
예제 #7
0
from yunity.models import Chat, Message
from yunity.utils.tests.mock import MockUser

sender, request_user = MockUser.create_batch(2)

chat = Chat.objects.create()
chat.participants.add(sender, request_user)
chatid = chat.id

messages = [
    Message.objects.create(
        content="This is message {}".format(i),
        type="TEXT",
        sent_by=sender,
        in_conversation=chat
    ) for i in range(10)
]

split = 6
before_messages = messages[:split]
the_message = messages[split]
after_messages = messages[split + 1:]
예제 #8
0
from yunity.conversations.models import ConversationMessage, ConversationType, Conversation
from yunity.utils.tests.mock import MockUser

initial_users = MockUser.create_batch(2)
request_user = initial_users[0]

chat = Conversation.objects.create(type=ConversationType.USER_MULTICHAT)
chat.participants.add(*initial_users)

ConversationMessage.objects.create(
    content="Hello group chat!",
    sent_by=initial_users[0],
    in_conversation=chat
)
예제 #9
0
from yunity.models import Chat, Message
from yunity.utils.tests.mock import MockUser

chat_starter, request_user = MockUser.create_batch(2)

chat = Chat.objects.create()
chat.participants.add(chat_starter)

Message.objects.create(content="Hey, I created a chat", type="TEXT", sent_by=chat_starter, in_conversation=chat)