Not sure about that belonging to tests. You use it in a management command, not in a unit test.