def test_api_files_post_admin():
    """Can a user post /api/v1/files if admin"""
    app = create_ctfd()
    with app.app_context():
        with login_as_user(app, name="admin") as client:
            with client.session_transaction() as sess:
                nonce = sess.get("nonce")
            r = client.post(
                "/api/v1/files",
                content_type="multipart/form-data",
                data={
                    "file": (BytesIO(b"test file content"), "test.txt"),
                    "nonce": nonce,
                },
            )
            assert r.status_code == 200
            f = Files.query.filter_by(id=1).first()
            assert f.sha1sum == "9032bbc224ed8b39183cb93b9a7447727ce67f9d"
            os.remove(os.path.join(app.config["UPLOAD_FOLDER"] + "/" + f.location))
    destroy_ctfd(app)
Can a user post /api/v1/files if admin
tests/api/v1/test_files.py