def test_api_topics_non_admin():
    """Can a user interact with /api/v1/topics if not admin"""
    app = create_ctfd()
    with app.app_context():
        gen_challenge(app.db)
        gen_topic(app.db, challenge_id=1)
        with app.test_client() as client:
            r = client.get("/api/v1/topics", json="")
            assert r.status_code == 403

            """Can a user post /api/v1/topics if not admin"""
            r = client.post("/api/v1/topics")
            assert r.status_code == 403

            """Can a user delete /api/v1/topics if not admin"""
            r = client.delete("/api/v1/topics")
            assert r.status_code == 403

            """Can a user get /api/v1/topics/<topic_id> if not admin"""
            r = client.get("/api/v1/topics/1", json="")
            assert r.status_code == 403

            """Can a user delete /api/v1/topics/<topic_id> if not admin"""
            r = client.delete("/api/v1/topics/1", json="")
            assert r.status_code == 403

        register_user(app)
        with login_as_user(app) as client:
            r = client.get("/api/v1/topics", json="")
            assert r.status_code == 403

            """Can a user post /api/v1/topics if not admin"""
            r = client.post("/api/v1/topics")
            assert r.status_code == 403

            """Can a user delete /api/v1/topics if not admin"""
            r = client.delete("/api/v1/topics")
            assert r.status_code == 403

            """Can a user get /api/v1/topics/<topic_id> if not admin"""
            r = client.get("/api/v1/topics/1", json="")
            assert r.status_code == 403

            """Can a user delete /api/v1/topics/<topic_id> if not admin"""
            r = client.delete("/api/v1/topics/1", json="")
            assert r.status_code == 403
    destroy_ctfd(app)
Can a user interact with /api/v1/topics if not admin
tests/api/v1/test_topics.py