Ejemplo n.º 1
0
def test_lockdown():
    USER = FlarumUser(forum_url=os.environ['forum_url'], username_or_email='test', password=os.environ['account_password'], extensions=[absolutely_all.AbsolutelyAllExtension, Flarum_Lock.LockExtension]) # type: absolutely_all.AbsolutelyAllFlarumUserMixin

    for discussions in USER.absolutely_all_discussions():
        for discussion in discussions:
            discussion: Flarum_Lock.LockDiscussionFromBulkMixin

            if not discussion.isLocked:
                locked = discussion.lock()
                print(f"Locked {locked.url}")

            else:
                print(f"{discussion.url} is already locked.")
Ejemplo n.º 2
0
def test_approve_unapproved():
    USER = FlarumUser(forum_url=os.environ['forum_url'], username_or_email='test', password=os.environ['account_password'], extensions=[absolutely_all.AbsolutelyAllExtension, Flarum_Approval.ApprovalExtension]) # type: absolutely_all.AbsolutelyAllFlarumUserMixin

    for discussions in USER.absolutely_all_discussions():
        for discussion in discussions:
            full_discussion = discussion.get_full_data()

            for post in full_discussion.get_posts():
                post: Flarum_Approval.ApprovalPostFromNotificationMixin

                if not post.isApproved:
                    post.approve()
                    print(f"Approved {post.url}")
                    time.sleep(3) # prevent 429

                else:
                    print(f"{post.url} is already approved.")
Ejemplo n.º 3
0
def test_follow_all_ignored():
    USER = FlarumUser(forum_url=os.environ['forum_url'],
                      username_or_email='test',
                      password=os.environ['account_password'],
                      extensions=[
                          absolutely_all.AbsolutelyAllExtension,
                          Flarum_Subscriptions.SubscriptionsExtension
                      ])  # type: absolutely_all.AbsolutelyAllFlarumUserMixin

    for discussions in USER.absolutely_all_discussions(
            Filter(query='is:ignored')):
        for discussion in discussions:
            discussion: Flarum_Subscriptions.SubscriptionsDiscussionFromBulkMixin
            discussion = discussion.follow()
            print(
                f"Now following ignored discussion {discussion.id} ({discussion.url})"
            )