def test_forum_get_from_category(app, authed_client): forums = Forum.from_category(1) assert len([f for f in forums if f]) == 2 for forum in forums: if forum.name == 'Bugs' and forum.id == 2: break else: raise AssertionError('A real forum not called')
def test_forum_get_from_category_cached(app, authed_client): cache.set(Forum.__cache_key_of_category__.format(id=2), ['1', '5'], timeout=60) Forum.from_pk(1) Forum.from_pk(5) # noqa: cache these forums = Forum.from_category(2) assert len(forums) == 2 for forum in forums: if forum.name == 'Yacht Funding' and forum.id == 5: break else: raise AssertionError('A real forum not called')
def test_forum_get_from_category_no_permissions(app, authed_client): db.engine.execute( "DELETE FROM users_permissions WHERE permission LIKE 'forumaccess%%'") forums = Forum.from_category(1) assert len(forums) == 0