Closed nvn-nil closed 2 days ago
Thanks for the idea @nvn-nil! I've applied it to:
Diagnostics
Topic
Subscription
GoogleCloudPubSubEventHandler
I'd already implemented the same thing in another way in Service
(I think at your request a while ago).
Feature request
Use Case
Create Google Cloud clients only as required to make it easy to test applications using octue. I recommend reviewing other uses of Google clients too.
Or maybe provide an escape hatch by providing an offline/local mode for tests.
Thanks in advance!
Current state
The clients for different google services are created in the init function. This makes patching very difficult for tests.
I'm monkey-patching this particular one in my tests. This was easier than patching many other functions that use the client when I'm only doing local unit tests.
This is obviously not ideal for a variety of reasons but was easier in my case.