-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1439 from betagouv/master
MEP
- Loading branch information
Showing
11 changed files
with
183 additions
and
28 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,7 +249,8 @@ class ReportControllerSpec(implicit ee: ExecutionEnv) extends Specification with | |
EmailAddress("[email protected]"), | ||
skipValidation, | ||
List(""), | ||
".*".r | ||
".*".r, | ||
40 | ||
) | ||
|
||
} | ||
|
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 |
---|---|---|
|
@@ -304,6 +304,61 @@ class MailServiceSpecFilteredEmail(implicit ee: ExecutionEnv) extends BaseMailSe | |
} | ||
} | ||
|
||
class MailServiceSpecGroupForMaxRecipients(implicit ee: ExecutionEnv) extends BaseMailServiceSpec { | ||
|
||
override def is = s2"""email must be grouped to prevent exceeding recipients limit $e1""" | ||
|
||
def e1 = { | ||
|
||
val recipients = List( | ||
EmailAddress(s"[email protected]"), | ||
EmailAddress(s"[email protected]"), | ||
EmailAddress(s"[email protected]") | ||
) | ||
|
||
val mailService = new MailService( | ||
mockMailRetriesService, | ||
emailConfiguration = emailConfiguration.copy(maxRecipientsPerEmail = 2), | ||
reportNotificationBlocklistRepo = components.reportNotificationBlockedRepository, | ||
pdfService = components.pdfService, | ||
attachmentService = components.attachmentService | ||
)( | ||
components.frontRoute, | ||
executionContext | ||
) | ||
|
||
ProNewReportNotification( | ||
NonEmptyList.of(EmailAddress(s"[email protected]"), EmailAddress(s"[email protected]")), | ||
reportForSubsidiary | ||
) | ||
|
||
Await.result( | ||
mailService.send( | ||
ProNewReportNotification( | ||
NonEmptyList.fromListUnsafe(recipients), | ||
reportForSubsidiary | ||
) | ||
), | ||
Duration.Inf | ||
) | ||
|
||
there was one(mockMailRetriesService).sendEmailWithRetries( | ||
argThat((emailRequest: EmailRequest) => | ||
emailRequest.recipients.size == 2 && emailRequest.recipients.toList.containsSlice( | ||
List(EmailAddress(s"[email protected]"), EmailAddress(s"[email protected]")) | ||
) | ||
) | ||
) | ||
|
||
there was one(mockMailRetriesService).sendEmailWithRetries( | ||
argThat((emailRequest: EmailRequest) => | ||
emailRequest.recipients.size == 1 && emailRequest.recipients.head == EmailAddress(s"[email protected]") | ||
) | ||
) | ||
|
||
} | ||
} | ||
|
||
//MailServiceSpecNoBlock | ||
//MailServiceSpecSomeBlock | ||
//MailServiceSpecAllBlock |