Ejemplo n.º 1
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.anonymous_user = AnonymousUser()
     cls.other_user = PublicUserFactory()
     cls.create_content_set()
     cls.public_reply = PublicContentFactory(parent=cls.public_content)
     cls.limited_reply = LimitedContentFactory(parent=cls.limited_content)
     cls.self_reply = SelfContentFactory(parent=cls.self_content)
     cls.site_reply = SiteContentFactory(parent=cls.site_content)
     cls.public_share = PublicContentFactory(share_of=cls.public_content,
                                             author=cls.remote_profile)
     cls.limited_share = LimitedContentFactory(share_of=cls.limited_content,
                                               author=cls.remote_profile)
     cls.self_share = SelfContentFactory(share_of=cls.self_content,
                                         author=cls.remote_profile)
     cls.site_share = SiteContentFactory(share_of=cls.site_content,
                                         author=cls.remote_profile)
     cls.public_share_reply = PublicContentFactory(parent=cls.public_share)
     cls.share_limited_reply = LimitedContentFactory(
         parent=cls.limited_share)
     cls.share_self_reply = SelfContentFactory(parent=cls.self_share)
     cls.share_site_reply = SiteContentFactory(parent=cls.site_share)
     cls.limited_content_user = UserFactory()
     cls.limited_content_profile = cls.limited_content_user.profile
     cls.limited_reply.limited_visibilities.add(cls.limited_content_profile)
     cls.limited_content.limited_visibilities.add(
         cls.limited_content_profile)
Ejemplo n.º 2
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.public_content = ContentFactory(pinned=True)
     cls.public_tag_content = ContentFactory(text="#foobar")
     cls.limited_content = LimitedContentFactory()
     cls.tag = Tag.objects.get(name="foobar")
     cls.site_content = SiteContentFactory(pinned=True)
     cls.site_tag_content = SiteContentFactory(text="#foobar")
     cls.self_user = UserFactory()
     cls.self_content = SelfContentFactory(author=cls.self_user.profile,
                                           pinned=True)
     cls.self_tag_content = SelfContentFactory(author=cls.self_user.profile,
                                               text="#foobar")
     cls.other_user = UserFactory()
     cls.anonymous_user = AnonymousUser()
     cls.other_user.profile.following.add(cls.public_content.author,
                                          cls.self_user.profile)
     cls.public_reply = PublicContentFactory(parent=cls.public_content)
     cls.limited_reply = LimitedContentFactory(parent=cls.limited_content)
     cls.self_reply = SelfContentFactory(parent=cls.self_content)
     cls.site_reply = SiteContentFactory(parent=cls.site_content)
     cls.public_share = PublicContentFactory(share_of=cls.public_content,
                                             author=cls.self_user.profile)
     cls.limited_share = LimitedContentFactory(share_of=cls.limited_content,
                                               author=cls.self_user.profile)
     cls.self_share = SelfContentFactory(share_of=cls.self_content,
                                         author=cls.self_user.profile)
     cls.site_share = SiteContentFactory(share_of=cls.site_content,
                                         author=cls.self_user.profile)
     cls.public_share_reply = PublicContentFactory(parent=cls.public_share)
     cls.share_limited_reply = LimitedContentFactory(
         parent=cls.limited_share)
     cls.share_self_reply = SelfContentFactory(parent=cls.self_share)
     cls.share_site_reply = SiteContentFactory(parent=cls.site_share)
Ejemplo n.º 3
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.create_content_set()
     cls.pinned_content = PublicContentFactory(author=cls.profile,
                                               pinned=True)
     cls.non_pinned_content = PublicContentFactory(author=cls.profile)
Ejemplo n.º 4
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.content = PublicContentFactory()
     cls.profile.following.add(cls.content.author)
     cls.limited_content = LimitedContentFactory()
     cls.reply = PublicContentFactory(parent=cls.content)
Ejemplo n.º 5
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.content = PublicContentFactory()
     cls.content2 = PublicContentFactory()
     SiteContentFactory()
     SelfContentFactory()
     LimitedContentFactory()
Ejemplo n.º 6
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.public_content = PublicContentFactory(
         pinned=True, author=ProfileFactory(visibility=Visibility.SELF))
     cls.public_tag_content = PublicContentFactory(text="#foobar")
     cls.limited_content = LimitedContentFactory(author=ProfileFactory(
         visibility=Visibility.SELF))
     cls.tag = Tag.objects.get(name="foobar")
     cls.site_content = SiteContentFactory(
         pinned=True, author=ProfileFactory(visibility=Visibility.SELF))
     cls.site_tag_content = SiteContentFactory(text="#foobar")
     cls.self_user = UserFactory()
     cls.self_content = SelfContentFactory(author=cls.self_user.profile,
                                           pinned=True)
     cls.self_tag_content = SelfContentFactory(author=cls.self_user.profile,
                                               text="#foobar")
     cls.other_user = UserFactory()
     cls.anonymous_user = AnonymousUser()
     cls.other_user.profile.following.add(cls.public_content.author,
                                          cls.self_user.profile)
     cls.other_user.profile.followed_tags.add(cls.tag)
     cls.limited_content_user = UserFactory()
     cls.limited_content_profile = cls.limited_content_user.profile
     cls.limited_content.limited_visibilities.add(
         cls.limited_content_profile)
     cls.limited_tag_content = LimitedContentFactory(text="#foobar")
     cls.limited_tag_content.limited_visibilities.add(
         cls.limited_content_profile)
     cls.local_user = UserFactory()
     cls.local_content = PublicContentFactory(author=cls.local_user.profile)
Ejemplo n.º 7
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.content = PublicContentFactory(author=cls.remote_profile)
     cls.content2 = PublicContentFactory(author=cls.remote_profile)
     SiteContentFactory(author=cls.profile)
     SelfContentFactory(author=cls.profile)
     LimitedContentFactory(author=cls.profile)
Ejemplo n.º 8
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.content = LocalContentFactory(visibility=Visibility.PUBLIC)
     cls.private_content = LocalContentFactory(
         visibility=Visibility.LIMITED)
     cls.client = Client()
     cls.reply = PublicContentFactory(parent=cls.content)
     cls.share = PublicContentFactory(share_of=cls.content)
Ejemplo n.º 9
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.user = UserFactory()
     cls.staff_user = AdminUserFactory()
     cls.create_content_set()
     cls.other_profile = ProfileFactory()
     cls.reply = PublicContentFactory(parent=cls.public_content)
     cls.share = PublicContentFactory(share_of=cls.public_content)
     cls.share_reply = PublicContentFactory(parent=cls.share)
Ejemplo n.º 10
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.profile.following.add(cls.remote_profile)
     cls.content = PublicContentFactory()
     cls.remote_content = PublicContentFactory(author=cls.remote_profile)
     cls.tagged_content = PublicContentFactory(text="#spam #eggs")
     cls.spam_tag = Tag.objects.get(name="spam")
     cls.eggs_tag = Tag.objects.get(name="eggs")
Ejemplo n.º 11
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.content = PublicContentFactory(author=cls.remote_profile)
     cls.content2 = PublicContentFactory(author=cls.remote_profile)
     cls.limited_content = LimitedContentFactory(author=cls.remote_profile)
     cls.limited_content2 = LimitedContentFactory(author=cls.profile)
     cls.user_content = PublicContentFactory(author=cls.profile)
     cls.share = PublicContentFactory(share_of=cls.content)
     cls.reply = PublicContentFactory(parent=cls.content)
Ejemplo n.º 12
0
 def setUpTestData(cls):
     super().setUpTestData()
     author = UserFactory()
     author.profile.rsa_private_key = get_dummy_private_key().exportKey()
     author.profile.save()
     cls.public_content = PublicContentFactory(author=author.profile)
     cls.remote_reply = PublicContentFactory(parent=cls.public_content, author=ProfileFactory())
     cls.reply = PublicContentFactory(parent=cls.public_content)
     cls.share = PublicContentFactory(share_of=cls.public_content)
     cls.share_reply = PublicContentFactory(parent=cls.share)
Ejemplo n.º 13
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.local_user = UserFactory()
     cls.create_content_set()
     cls.tagged_foobar = PublicContentFactory(text="#foobar", author=cls.profile)
     cls.tagged_foobar2 = SiteContentFactory(text="#foobar", author=cls.profile)
     cls.tagged_spam = PublicContentFactory(text="#spam", author=cls.profile)
     cls.tagged_spam2 = SiteContentFactory(text="#spam", author=cls.profile)
     cls.tag_foobar = Tag.objects.get(name="foobar")
     cls.tag_spam = Tag.objects.get(name="spam")
     cls.user.profile.followed_tags.add(cls.tag_spam)
Ejemplo n.º 14
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     PublicContentFactory(text="#foobar")
     SiteContentFactory(text="#foobar")
     SelfContentFactory(text="#foobar")
     LimitedContentFactory(text="#foobar")
     cls.content = PublicContentFactory(text="#spam")
     cls.content2 = SiteContentFactory(text="#spam")
     SelfContentFactory(text="#spam")
     LimitedContentFactory(text="#spam")
     cls.profile.followed_tags.add(Tag.objects.get(name="spam"))
Ejemplo n.º 15
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.content = ContentFactory()
     cls.local_content = LocalContentFactory()
     cls.create_local_and_remote_user()
     cls.reply = PublicContentFactory(
         author=cls.content.author,
         content_type=ContentType.REPLY,
         parent=cls.content,
     )
     cls.share = PublicContentFactory(
         author=cls.content.author,
         content_type=ContentType.SHARE,
         share_of=cls.content,
     )
Ejemplo n.º 16
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.content = PublicContentFactory(text="#foobar")
     SiteContentFactory(text="#foobar")
     SelfContentFactory(text="#foobar")
     LimitedContentFactory(text="#foobar")
Ejemplo n.º 17
0
 def create_content_set(target, author=None):
     if not author:
         author = PublicProfileFactory()
     target.public_content = PublicContentFactory(author=author)
     target.site_content = SiteContentFactory(author=author)
     target.self_content = SelfContentFactory(author=author)
     target.limited_content = LimitedContentFactory(author=author)
Ejemplo n.º 18
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.local_content = LocalContentFactory()
     cls.local_content2 = LocalContentFactory(guid=str(uuid4()))
     cls.remote_content = PublicContentFactory()
     cls.remote_profile2 = PublicProfileFactory()
    def handle(self, *args, **options):
        """Create dummy content."""
        for i in range(options["amount"]):
            content = PublicContentFactory()
            print("Created content: %s" % content)

        user_email = options["user_email"]
        if user_email is not None:

            user = User.objects.get(email=user_email)
            if user is None:
                print("Error: no user with email {0} found").format(user_email)
            else:
                all_profiles = Profile.objects.exclude(uuid=user.profile.uuid)[::1]
                count = len(all_profiles)
                nb_contacts = min(count, 500)

                shuffle(all_profiles)
                user.profile.following.add(*all_profiles[:nb_contacts])
                print("Added %s contacts to %s's followed contacts" % (nb_contacts, user_email))

                shuffle(all_profiles)
                profiles = all_profiles[:nb_contacts]
                [profile.following.add(user.profile) for profile in profiles]
                print("Added %s contacts to %s's followers" % (nb_contacts, user_email))
Ejemplo n.º 20
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.user = UserFactory()
     cls.other_user = UserFactory()
     cls.profile = cls.user.profile
     cls.create_content_set(author=cls.profile)
     cls.remote_content = PublicContentFactory()
Ejemplo n.º 21
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.anonymous_user = AnonymousUser()
     cls.other_user = PublicUserFactory()
     cls.create_content_set()
     cls.public_share = PublicContentFactory(share_of=cls.public_content,
                                             author=cls.other_user.profile)
     cls.public_share2 = PublicContentFactory(share_of=cls.public_content)
     cls.limited_share = LimitedContentFactory(
         share_of=cls.limited_content, author=cls.other_user.profile)
     cls.self_share = SelfContentFactory(share_of=cls.self_content,
                                         author=cls.other_user.profile)
     cls.site_share = SiteContentFactory(share_of=cls.site_content,
                                         author=cls.other_user.profile)
     cls.other_user.profile.following.add(cls.public_content.author,
                                          cls.profile)
Ejemplo n.º 22
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.user = PublicUserFactory()
     cls.profile = cls.user.profile
     cls.site_user = SiteUserFactory()
     cls.site_profile = cls.site_user.profile
     cls.content = PublicContentFactory(author=cls.profile)
     cls.site_content = SiteContentFactory(author=cls.profile)
Ejemplo n.º 23
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.remote_profile.followers.add(cls.profile)
     cls.create_content_set(author=cls.remote_profile)
     cls.other_public_content = PublicContentFactory()
     SiteContentFactory()
     SelfContentFactory()
     LimitedContentFactory()
Ejemplo n.º 24
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.user = UserFactory()
     cls.profile = ProfileFactory(visibility=Visibility.PUBLIC, handle='*****@*****.**')
     cls.profile2 = ProfileFactory(visibility=Visibility.SITE, handle='*****@*****.**')
     cls.self_profile = ProfileFactory(visibility=Visibility.SELF, handle="*****@*****.**")
     cls.content = PublicContentFactory()
     cls.limited_content = LimitedContentFactory(author=cls.user.profile)
     cls.limited_content.limited_visibilities.set((cls.profile, cls.profile2))
     cls.user.profile.following.add(cls.profile2)
Ejemplo n.º 25
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.local_user = UserFactory()
     cls.create_content_set()
     cls.public_tagged = PublicContentFactory(text="#foobar", author=cls.profile)
     cls.site_tagged = SiteContentFactory(text="#foobar", author=cls.profile)
     cls.self_tagged = SelfContentFactory(text="#foobar", author=cls.profile)
     cls.limited_tagged = LimitedContentFactory(text="#foobar", author=cls.profile)
     cls.tag = cls.public_tagged.tags.first()
Ejemplo n.º 26
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.user = PublicUserFactory()
     cls.content = PublicContentFactory(author=cls.user.profile)
     cls.content2 = PublicContentFactory()
     cls.sharer_content = PublicContentFactory()
     cls.sharer_content_share = PublicContentFactory(
         share_of=cls.sharer_content)
     cls.share = PublicContentFactory(share_of=cls.content,
                                      author=cls.sharer_content.author)
     cls.share2 = PublicContentFactory(share_of=cls.content2,
                                       author=cls.sharer_content.author)
     cls.user.profile.following.add(cls.sharer_content.author)
Ejemplo n.º 27
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.user_recipient = PublicProfileFactory()
     cls.user_recipient2 = PublicProfileFactory()
     cls.content = PublicContentFactory(author=cls.remote_profile)
     cls.content2 = PublicContentFactory(author=cls.remote_profile)
     cls.limited_content = LimitedContentFactory(author=cls.remote_profile)
     cls.limited_content2 = LimitedContentFactory(author=cls.profile)
     cls.limited_content_with_recipients = LimitedContentWithRecipientsFactory(recipients=[
         cls.user_recipient, cls.user_recipient2
     ])
     cls.user_content = PublicContentFactory(author=cls.profile)
     cls.share = PublicContentFactory(share_of=cls.content)
     cls.reply = PublicContentFactory(parent=cls.content)
     cls.reply_parent_with_recipients = PublicContentFactory(parent=cls.limited_content_with_recipients)
Ejemplo n.º 28
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.user = PublicUserFactory()
     cls.content_spam = PublicContentFactory(text="#spam")
     cls.content_eggs = PublicContentFactory(text="#eggs")
     cls.client = Client()
Ejemplo n.º 29
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.create_local_and_remote_user()
     cls.profile.following.add(cls.remote_profile)
     cls.content = PublicContentFactory()
     cls.remote_content = PublicContentFactory(author=cls.remote_profile)
Ejemplo n.º 30
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.user = PublicUserFactory()
     cls.user_content = PublicContentFactory(author=cls.user.profile)
     cls.profile = PublicProfileFactory()
     cls.profile_content = PublicContentFactory(author=cls.profile)