-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for email template for eduID only invitations
- Loading branch information
Showing
1 changed file
with
23 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
import java.util.Set; | ||
import java.util.UUID; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
class MailBoxTest extends AbstractMailTest { | ||
|
@@ -21,12 +22,31 @@ class MailBoxTest extends AbstractMailTest { | |
|
||
@Test | ||
void sendInviteMail() { | ||
String htmlContent = doSendInviteMail(true, Authority.INVITER); | ||
|
||
assertTrue(htmlContent.contains("Wiki EN")); | ||
assertTrue(htmlContent.contains("SURF bv")); | ||
assertTrue(htmlContent.contains("For access to these applications we use SURFconext")); | ||
assertFalse(htmlContent.contains("For access to these applications eduID is used")); | ||
} | ||
|
||
@Test | ||
void sendInviteMailForEduIDOnly() { | ||
String htmlContent = doSendInviteMail(true, Authority.GUEST); | ||
|
||
assertTrue(htmlContent.contains("Wiki EN")); | ||
assertTrue(htmlContent.contains("SURF bv")); | ||
assertFalse(htmlContent.contains("For access to these applications we use SURFconext")); | ||
assertTrue(htmlContent.contains("For access to these applications eduID is used")); | ||
} | ||
|
||
private String doSendInviteMail(boolean eduIDOnly, Authority intendedAuthority) { | ||
User user = new User(false, "eppn", "sub", "example.com", "John", "Doe", "[email protected]"); | ||
Invitation invitation = new Invitation(Authority.GUEST, | ||
Invitation invitation = new Invitation(intendedAuthority, | ||
"hash", | ||
"[email protected]", | ||
false, | ||
false, | ||
eduIDOnly, | ||
false, | ||
"Please join..", | ||
user, | ||
|
@@ -45,10 +65,7 @@ void sendInviteMail() { | |
UUID.randomUUID().toString()) | ||
)); | ||
MimeMessageParser mimeMessageParser = super.mailMessage(); | ||
String htmlContent = mimeMessageParser.getHtmlContent(); | ||
|
||
assertTrue(htmlContent.contains("Wiki EN")); | ||
assertTrue(htmlContent.contains("SURF bv")); | ||
return mimeMessageParser.getHtmlContent(); | ||
} | ||
|
||
|
||
|