you can actually use mock.patch to do what you did with logger.warn.
This way, you would also be able to check that a warning was made.