The controversial event and the NYPD’s response to resulting protests present a test for Mayor Zohran Mamdani.