def test_api_user_delete_admin():
    """Can a user patch /api/v1/users/<user_id> if admin"""
    app = create_ctfd()
    with app.app_context():
        register_user(app)
        user = Users.query.filter_by(id=2).first()
        simulate_user_activity(app.db, user=user)
        with login_as_user(app, "admin") as client:
            r = client.delete("/api/v1/users/2", json="")
            assert r.status_code == 200
            assert r.get_json().get("data") is None
        assert Users.query.filter_by(id=2).first() is None
    destroy_ctfd(app)
Can a user patch /api/v1/users/<user_id> if admin
tests/api/v1/test_users.py