Ejemplo n.º 1
0
 def test_user_wall_is_community_readable_user_child(self):
     u = MockUser.create(profile_visibility=ProfileVisibility.COMMUNITIES)
     g = Group.objects.filter(name='2ba').first()
     g.hub.hubmembership_set.create(user=u)
     c = resolve_permissions(u.wall)
     community = Group.objects.filter(name='toplevel group 2').first()
     self.assertEqual(c.group_trees, [(community, WallAction.READ)],
                      'set of communities differs from communities user is part of')
Ejemplo n.º 2
0
from yunity.utils.tests.mock import MockUser

request_user = MockUser.create()
Ejemplo n.º 3
0
from yunity.utils.tests.mock import MockUser

users = [
    MockUser.create(email="*****@*****.**",
                    display_name="I am the existing user"),
]
Ejemplo n.º 4
0
from yunity.conversations.models import ConversationType
from yunity.utils.tests.mock import MockUser, MockConversation

users = [
    MockUser.create(email="*****@*****.**", display_name="Testuser1"),
    MockUser.create(email="*****@*****.**", display_name="Testuser2"),
]

chat = MockConversation.create(participants=users, type=ConversationType.ONE_ON_ONE)
Ejemplo n.º 5
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)
Ejemplo n.º 6
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)
Ejemplo n.º 7
0
 def test_user_wall_is_public_readable(self):
     u = MockUser.create(profile_visibility=ProfileVisibility.PUBLIC)
     c = resolve_permissions(u.wall)
     self.assertEqual(c.public_actions, [WallAction.READ], 'user wall not public readable')
Ejemplo n.º 8
0
from yunity.conversations.models import ConversationType
from yunity.utils.tests.mock import MockUser, MockConversation

users = [
    MockUser.create(email="*****@*****.**", display_name="Testuser1"),
    MockUser.create(email="*****@*****.**", display_name="Testuser2"),
]

chat = MockConversation.create(participants=users,
                               type=ConversationType.ONE_ON_ONE)
Ejemplo n.º 9
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
)
Ejemplo n.º 10
0
from yunity.utils.tests.mock import MockUser

user = MockUser.create()
Ejemplo n.º 11
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)
Ejemplo n.º 12
0
from yunity.utils.tests.mock import MockUser

users = [
    MockUser.create(email="*****@*****.**", display_name="I am the existing user"),
]
Ejemplo n.º 13
0
from yunity.utils.tests.mock import MockUser, MockConversation

users = MockUser.create_batch(3)
request_user = MockUser.create()
chat = MockConversation.create(participants=users)
chat_id = chat.id
Ejemplo n.º 14
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
)
Ejemplo n.º 15
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:]
Ejemplo n.º 16
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
)
Ejemplo n.º 17
0
from yunity.utils.tests.mock import MockUser

request_user = MockUser.create()
add_users = MockUser.create_batch(2)
Ejemplo n.º 18
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",
Ejemplo n.º 19
0
 def test_user_wall_is_author_readable(self):
     u = MockUser.create(profile_visibility=ProfileVisibility.PRIVATE)
     c = resolve_permissions(u.wall)
     self.assertIncludes(c.users, (u, WallAction.READ))