That code from SecureHandlers.lua is for handling dragging. The code to handle clicking/using a button is in SecureTemplates.lua, specifically the possible options for "type" are the entries in the SECURE_ACTIONS table. Based on that you will probably want:
Code:
button:SetAttribute("type", "macro")
button:SetAttribute("macrotext", "/equipset test")