-
Notifications
You must be signed in to change notification settings - Fork 0
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
PC-690 alternative confirmation email for pending LA users #252
PC-690 alternative confirmation email for pending LA users #252
Conversation
…ifferent email template if the LA is "Pending"
Noticed an issue with the copy text for the email "lcoal". I've fixed this on GovNotify. |
@Glenn-Clarke I expect it would make each of these easier to review if you were to change the base branch to the next one down in the chain, if that makes sense. Can figure out how they're best off being merged later on. Would you mind doing that? |
I've chained the merges :) |
…-in-Pending-LAs' into PC-690-Alternative-confirmation-email-for-Pending-LA-Users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to add a test for your new functionality here, to check that it sends the correct email for a pending LA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jamiehumphries I've added the test to this, but to be able to Mock the response from the custodian code lookup, I had to make the lookup function virtual. There must be a better way to do this, surely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Glenn-Clarke, I think the best thing to do is just find a custodian code to use that matches what you need for the tests.
You don't always need to use mocks for everything, if you can set up your data appropriately without them.
e.g.
private string liveCustodianCode;
private string pendingCustodianCode;
...
[SetUp]
public void Setup()
{
liveCustodianCode = GetExampleCustodianCodeForStatus(LocalAuthorityData.Hug2Status.Live);
pendingCustodianCode = GetExampleCustodianCodeForStatus(LocalAuthorityData.Hug2Status.Pending);
...
}
...
[Test]
public void SomeTestThatNeedsPending()
{
var testCustodianCode = pendingCustodianCode;
...
}
...
private string GetExampleCustodianCodeForStatus(LocalAuthorityData.Hug2Status status)
{
return LocalAuthorityData.LocalAuthorityDetailsByCustodianCode
.First(entry => entry.Value.Status == status)
.Key;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi this is really useful, thank you for the example,
I think I didn't go for something like this option originally because I thought that with something like Pending, we can't always assume there will be Local Authorities in that stage. So I didn't want to source one from the list, because then the tests would fail if that situation occurred, not because there was an issue with the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's definitely a fair concern in general. Your other option in that case would be to add a dummy Pending LA in to the dictionary during the test setup.
I think either is fine in our particular case, where the LA data is all defined in code. The point at which there are no "Pending" LAs is controlled in the code, so the test can't start failing due to a non-code data change.
But yes, if you wanted to defend against there being no "Pending" ones, you could achieve that with a more involved setup that adds dummy data to the dictionary. Up to you if you want to implement that here or not. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, thanks for explaining the thought process :)
HerPublicWebsite.BusinessLogic/ExternalServices/EmailSending/GovUkNotifyApi.cs
Outdated
Show resolved
Hide resolved
HerPublicWebsite.BusinessLogic/ExternalServices/EmailSending/GovUkNotifyApi.cs
Outdated
Show resolved
Hide resolved
HerPublicWebsite.BusinessLogic/ExternalServices/EmailSending/GovUkNotifyApi.cs
Outdated
Show resolved
Hide resolved
HerPublicWebsite.BusinessLogic/ExternalServices/EmailSending/GovUkNotifyApi.cs
Outdated
Show resolved
Hide resolved
HerPublicWebsite.BusinessLogic/ExternalServices/EmailSending/GovUkNotifyConfiguration.cs
Outdated
Show resolved
Hide resolved
HerPublicWebsite.BusinessLogic/ExternalServices/EmailSending/GovUkNotifyApi.cs
Outdated
Show resolved
Hide resolved
HerPublicWebsite.BusinessLogic/ExternalServices/EmailSending/IEmailSender.cs
Outdated
Show resolved
Hide resolved
…-in-Pending-LAs' into PC-690-Alternative-confirmation-email-for-Pending-LA-Users
…f parentheses trailing multiline parameters.
…erties. Using ReferralRequests instead of using reference code and custodian code separately.
…on Local Authority Pending/Live status
…-in-Pending-LAs' into PC-690-Alternative-confirmation-email-for-Pending-LA-Users
@Glenn-Clarke, I spotted this typo in your image above, but it looks like you have already fixed it on Notify: Can you confirm that you have indeed fixed it and I'm not just looking in the wrong place? |
Hi @jamiehumphries , |
HerPublicWebsite.BusinessLogic/ExternalServices/EmailSending/GovUkNotifyApi.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NB: I haven't fully reviewed the test code below, since I expect that there will be a reasonable number of changes by the the time you've fixed these tests and implemented my suggestion to remove the need for virtual
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HerPublicWebsite.UnitTests/BusinessLogic/QuestionnaireUpdaterTests.cs
Outdated
Show resolved
Hide resolved
HerPublicWebsite.UnitTests/BusinessLogic/QuestionnaireUpdaterTests.cs
Outdated
Show resolved
Hide resolved
HerPublicWebsite.UnitTests/BusinessLogic/QuestionnaireUpdaterTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Glenn-Clarke, I think the best thing to do is just find a custodian code to use that matches what you need for the tests.
You don't always need to use mocks for everything, if you can set up your data appropriately without them.
e.g.
private string liveCustodianCode;
private string pendingCustodianCode;
...
[SetUp]
public void Setup()
{
liveCustodianCode = GetExampleCustodianCodeForStatus(LocalAuthorityData.Hug2Status.Live);
pendingCustodianCode = GetExampleCustodianCodeForStatus(LocalAuthorityData.Hug2Status.Pending);
...
}
...
[Test]
public void SomeTestThatNeedsPending()
{
var testCustodianCode = pendingCustodianCode;
...
}
...
private string GetExampleCustodianCodeForStatus(LocalAuthorityData.Hug2Status status)
{
return LocalAuthorityData.LocalAuthorityDetailsByCustodianCode
.First(entry => entry.Value.Status == status)
.Key;
}
Ah, so you did! Thanks. 😄 |
…moved Virtual requirement, and added new test and Pending case for if a user confirms initially with Phone number, and instead submits email on the Confirmation page.
Hi, while sorting the tests I noticed there was one case where Pending wasn't respected,
I've added that case in, and then added the corresponding test for it. |
Well spotted, thanks. 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to merge. 👍
THIS PR BUILDS UPON PC-778
When a user reaches the confirmation page and they've selected a local authority with a Pending status, a "pending" template is sent to the user.
Live LA user:
![image](https://private-user-images.githubusercontent.com/152421975/304401505-097924cf-72d8-4dd4-8655-7b72097ed680.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NDc1ODcsIm5iZiI6MTczODk0NzI4NywicGF0aCI6Ii8xNTI0MjE5NzUvMzA0NDAxNTA1LTA5NzkyNGNmLTcyZDgtNGRkNC04NjU1LTdiNzIwOTdlZDY4MC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwN1QxNjU0NDdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jZmQzOGM0NjNjYzgxNjFmZGFlOWRiNjViYjgzY2I2OGMwZmY0MDBhN2ViMWFhZWVjMmUwMDAwMjFjZmI2YjVhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.LRgTMnBJlxgM2d1XNRbsCOcnSx4O-Ej6XvolRsTaiBA)
Pending LA user:
![image](https://private-user-images.githubusercontent.com/152421975/304401556-d41e4090-c086-4a0c-a929-4e64dc7b4bab.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVk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