From the first glance I see a problem in your test:
You are using the logs var outside the context (with block).
As for me if I want to test logging in the code I just mock the logger in the module and check if it was called correctly. It always work and is easy to understand.