Exemple #1
0
def test_thread_get_from_forum(app, authed_client):
    threads = ForumThread.from_forum(1, page=1, limit=50)
    assert len(threads) == 1

    for thread in threads:
        if thread.topic == 'New Site' and thread.id == 1:
            break
    else:
        raise AssertionError('A real thread not called')
Exemple #2
0
def test_thread_get_from_forum_cached(app, authed_client):
    cache.set(ForumThread.__cache_key_of_forum__.format(id=2), [1, 5],
              timeout=60)
    ForumThread.from_pk(1)
    ForumThread.from_pk(5)  # noqa cache these
    threads = ForumThread.from_forum(2, page=1, limit=50)
    assert len(threads) == 2

    for thread in threads:
        if thread.topic == 'Donations?' and thread.id == 5:
            break
    else:
        raise AssertionError('A real thread not called')
Exemple #3
0
def test_thread_get_from_forum_no_perms(app, authed_client):
    db.engine.execute(
        "DELETE FROM users_permissions WHERE permission LIKE 'forumaccess%%'")
    threads = ForumThread.from_forum(1, page=1, limit=50)
    assert len(threads) == 0