-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Create instructor request acknowledgement email * Add tests for acknowledgement email * Fix test cases * Fix comments in expected email * Use config support email value in email template * Fix email recipient * Fix test expected emails * Remove trailing space * Use placeholder for support email * Sanitize acknowledgement email * Set acknowledgement email to bcc support
- Loading branch information
Showing
9 changed files
with
275 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/resources/instructorEmailTemplate-newAccountRequestAcknowledgement.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<p>Hello, ${name}</p> | ||
|
||
<p> | ||
Thank you for submitting an account request. This is what you have submitted: | ||
</p> | ||
|
||
<div> | ||
<table style="max-width:600px;border:1px solid black;"> | ||
<tr> | ||
<td style="padding:5px;"> | ||
<strong> | ||
Full Name | ||
</strong> | ||
</td> | ||
<td style="padding:5px;"> | ||
${name} | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td style="padding:5px;"> | ||
<strong> | ||
Country & Institute | ||
</strong> | ||
</td> | ||
<td style="padding:5px;"> | ||
${institute} | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td style="padding:5px;"> | ||
<strong> | ||
Email Address | ||
</strong> | ||
</td> | ||
<td style="padding:5px;"> | ||
${emailAddress} | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td style="padding:5px;"> | ||
<strong> | ||
Home Page URL<br>& Comments | ||
</strong> | ||
</td> | ||
<td style="padding:5px;"> | ||
${comments} | ||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
|
||
<p> | ||
Your request will be reviewed within 24 hours. We will send another email once your request has been accepted. | ||
</p> | ||
<p> | ||
If you have any additional queries, please feel free to contact us at ${supportEmail}. | ||
</p> | ||
|
||
<p> | ||
Regards,<br> | ||
TEAMMATES Team. | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,29 @@ void testGenerateNewAccountRequestAdminAlertEmail_withNoComments_generatesSucces | |
"/adminNewAccountRequestAlertEmailWithNoComments.html"); | ||
} | ||
|
||
@Test | ||
void testGenerateNewAccountRequestAcknowledgementEmail_withComments_generatesSuccessfully() throws IOException { | ||
AccountRequest accountRequest = new AccountRequest("[email protected]", "Darth Vader", "Sith Order", | ||
AccountRequestStatus.PENDING, | ||
"I Am Your Father"); | ||
EmailWrapper email = sqlEmailGenerator.generateNewAccountRequestAcknowledgementEmail(accountRequest); | ||
verifyEmail(email, "[email protected]", EmailType.NEW_ACCOUNT_REQUEST_ACKNOWLEDGEMENT, | ||
"TEAMMATES: Acknowledgement of Instructor Account Request", | ||
Config.SUPPORT_EMAIL, | ||
"/instructorNewAccountRequestAcknowledgementEmailWithComments.html"); | ||
} | ||
|
||
@Test | ||
void testGenerateNewAccountRequestAcknowledgementEmail_withNoComments_generatesSuccessfully() throws IOException { | ||
AccountRequest accountRequest = new AccountRequest("[email protected]", "Maul", "Sith Order", | ||
AccountRequestStatus.PENDING, null); | ||
EmailWrapper email = sqlEmailGenerator.generateNewAccountRequestAcknowledgementEmail(accountRequest); | ||
verifyEmail(email, "[email protected]", EmailType.NEW_ACCOUNT_REQUEST_ACKNOWLEDGEMENT, | ||
"TEAMMATES: Acknowledgement of Instructor Account Request", | ||
Config.SUPPORT_EMAIL, | ||
"/instructorNewAccountRequestAcknowledgementEmailWithNoComments.html"); | ||
} | ||
|
||
private void verifyEmail(EmailWrapper email, String expectedRecipientEmailAddress, EmailType expectedEmailType, | ||
String expectedSubject, String expectedEmailContentFilePathname) throws IOException { | ||
assertEquals(expectedRecipientEmailAddress, email.getRecipient()); | ||
|
@@ -52,6 +75,20 @@ private void verifyEmail(EmailWrapper email, String expectedRecipientEmailAddres | |
verifyEmailContentHasNoPlaceholders(emailContent); | ||
} | ||
|
||
private void verifyEmail(EmailWrapper email, String expectedRecipientEmailAddress, EmailType expectedEmailType, | ||
String expectedSubject, String expectedBcc, String expectedEmailContentFilePathname) throws IOException { | ||
assertEquals(expectedRecipientEmailAddress, email.getRecipient()); | ||
assertEquals(Config.EMAIL_SENDEREMAIL, email.getSenderEmail()); | ||
assertEquals(Config.EMAIL_SENDERNAME, email.getSenderName()); | ||
assertEquals(Config.EMAIL_REPLYTO, email.getReplyTo()); | ||
assertEquals(expectedEmailType, email.getType()); | ||
assertEquals(expectedSubject, email.getSubject()); | ||
assertEquals(expectedBcc, email.getBcc()); | ||
String emailContent = email.getContent(); | ||
EmailChecker.verifyEmailContent(emailContent, expectedEmailContentFilePathname); | ||
verifyEmailContentHasNoPlaceholders(emailContent); | ||
} | ||
|
||
private void verifyEmailContentHasNoPlaceholders(String emailContent) { | ||
assertFalse(emailContent.contains("${")); | ||
} | ||
|
65 changes: 65 additions & 0 deletions
65
src/test/resources/emails/instructorNewAccountRequestAcknowledgementEmailWithComments.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<p>Hello, Darth Vader</p> | ||
|
||
<p> | ||
Thank you for submitting an account request. This is what you have submitted: | ||
</p> | ||
|
||
<div> | ||
<table style="max-width:600px;border:1px solid black;"> | ||
<tr> | ||
<td style="padding:5px;"> | ||
<strong> | ||
Full Name | ||
</strong> | ||
</td> | ||
<td style="padding:5px;"> | ||
Darth Vader | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td style="padding:5px;"> | ||
<strong> | ||
Country & Institute | ||
</strong> | ||
</td> | ||
<td style="padding:5px;"> | ||
Sith Order | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td style="padding:5px;"> | ||
<strong> | ||
Email Address | ||
</strong> | ||
</td> | ||
<td style="padding:5px;"> | ||
[email protected] | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td style="padding:5px;"> | ||
<strong> | ||
Home Page URL<br>& Comments | ||
</strong> | ||
</td> | ||
<td style="padding:5px;"> | ||
I Am Your Father | ||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
|
||
<p> | ||
Your request will be reviewed within 24 hours. We will send another email once your request has been accepted. | ||
</p> | ||
<p> | ||
If you have any additional queries, please feel free to contact us at ${support.email}. | ||
</p> | ||
|
||
<p> | ||
Regards,<br> | ||
TEAMMATES Team. | ||
</p> |
65 changes: 65 additions & 0 deletions
65
src/test/resources/emails/instructorNewAccountRequestAcknowledgementEmailWithNoComments.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<p>Hello, Maul</p> | ||
|
||
<p> | ||
Thank you for submitting an account request. This is what you have submitted: | ||
</p> | ||
|
||
<div> | ||
<table style="max-width:600px;border:1px solid black;"> | ||
<tr> | ||
<td style="padding:5px;"> | ||
<strong> | ||
Full Name | ||
</strong> | ||
</td> | ||
<td style="padding:5px;"> | ||
Maul | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td style="padding:5px;"> | ||
<strong> | ||
Country & Institute | ||
</strong> | ||
</td> | ||
<td style="padding:5px;"> | ||
Sith Order | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td style="padding:5px;"> | ||
<strong> | ||
Email Address | ||
</strong> | ||
</td> | ||
<td style="padding:5px;"> | ||
[email protected] | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td style="padding:5px;"> | ||
<strong> | ||
Home Page URL<br>& Comments | ||
</strong> | ||
</td> | ||
<td style="padding:5px;"> | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
|
||
<p> | ||
Your request will be reviewed within 24 hours. We will send another email once your request has been accepted. | ||
</p> | ||
<p> | ||
If you have any additional queries, please feel free to contact us at ${support.email}. | ||
</p> | ||
|
||
<p> | ||
Regards,<br> | ||
TEAMMATES Team. | ||
</p> |