Closed mgax closed 1 month ago
@olivierphi sorry for the late change, I've refactored some of the tests, to include a new MemoryCampaignBackend
class that helps with mocking a campaign backend, because I've found it useful for subsequent tests. Would you mind checking the new changes too? Thanks!
Fixes https://github.com/wagtail/wagtail-newsletter/issues/14.
This PR introduces the queryish library, to wrap the Mailchimp API results into a queryset-like interface, which can be consumed by ChooserViewSet, to have a nice picker for the
audience
andsegment
fields of the Recipients model.Individual results are cached for 5 minutes (configurable) so that repeated page loads don't stall waiting for API calls to Mailchimp.
The recipients model is swappable, and I'll add some tests around this when implementing https://github.com/wagtail/wagtail-newsletter/issues/15 (when the recipients model will actually be referenced).