attach: Write tests on templates

Close #774