I agree with Junilu. I don't ask for permission to refactor or write unit tests. Those are part of the process.
I also don't "ask for permission" to write code that works or to touch type instead of hunt and peck or.... Wait. That sounds silly; it is expected isn't it? Of course, writing working code is expected. Refactoring and unit tests help make that happen. As long as I am delivering over the long run, the PM and BA shouldn't be telling me how to do my job.
Incidentally, I had a task to modify a template and upload it to the server. I had to do this three times this week. (I'm the first one on the team who has done this - it is harder than it sounds.) The first time, I did it wrong and caused 30 minutes of re-work. I documented the correct way all proud that we had a procedure. The second time, I did it wrong and caused 45 minutes of re-work. (What I did wrong was more subtle the second time since I didn't make the obvious errors.) Today was the third time I needed to make yet another modification to this template. i wrote a script to incorporate the changes and do the update. It took me almost an hour to write and
junit test the script. The script then worked on the first attempt.
Note that nowhere in this description was "ask the PM for permission to write a script." I did it because it was the right thing to do. I believe it will save time in the long run. (Or next week based on my rate of success in doing it by hand.) I believe it will save my teammates time by preventing them from having to deal with all the error prone details. In a nutshell, it was the right thing to do. It is our job to look out for the future and not just the present.