Testosterone was historically used to treat depression. I think that it was more common prior to the development of SSRIs, which are much more effective.
More recent research has been mixed. Some studies have found no benefit, whilst others show it helps, particularly with treatment-resistant depression. There is a correlation between low free testosterone and depressive disorders, which might explain why it can work.
On a personal, anecdotal level, I've found that it helps. It's about as effective as 50 or 100 mg of Sertraline / Zoloft (a common SSRI), but without the side effects. But my suspicion is that I'd need a higher dose of testosterone to balance my mood than is necessary for treating hypogonadism.