Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Three improvements to the email-alert-api test helpers #1132

Merged
merged 3 commits into from
Jan 24, 2022

Conversation

barrucadu
Copy link
Contributor

Firstly, adding content_id to the subscriber lists URL helper.

The way the test helpers handle subscriber lists is kind of weird. We pass all the parameters---both the request and response ones undifferentiated---into a single has_subscriber_list method, which then uses an allowlist to pluck out the parameters which should go in the request URL, and uses the others to construct the response. This is pretty strange, the only benefit I can see is that some parameters you'd otherwise have to specify twice, but the cost is that we have this list here which has to be kept up to date. I think it would be better to remove the need for this entirely, but that can be a later change.

Secondly, adding sender_message_id and govuk_request_id to the bulk-unsubscribe bad-request helper.

These were left off because the only time the endpoint raises a bad request response is if you don't specify these. But that makes it kind of difficult to actually use in the email-alert-service tests: I could blank out the govuk_request_id easily enough, but I can't blank out the sender_message_id - so in practice this helper can't actually be used. So I've added those parameters in.

Thirdly, adding both with- and without-message versions of the bulk-unsubscribe helpers.

This is useful because, in cases where we don't care about what the message actually is (like the above case when we're testing a 422 response is gracefully handled), we can use the without-message variants.

Copy link
Member

@huwd huwd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvements, nice one

@barrucadu barrucadu merged commit b0056fa into master Jan 24, 2022
@barrucadu barrucadu deleted the msw/email-test-helpers branch January 24, 2022 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants