1
0
mirror of https://github.com/google/nomulus synced 2026-02-09 22:40:55 +00:00

Set payload in success response after sending notification emails (#1377)

* Set payload in success response after sending expiring certificate notification emails

* Modify log message and test cases for run() in sendExpiringCertificateNotificationEmailAction
This commit is contained in:
Rachel Guan
2021-10-13 15:58:25 -04:00
committed by GitHub
parent 2aff72b3b6
commit bb8988ee4e
2 changed files with 32 additions and 4 deletions

View File

@@ -639,9 +639,32 @@ class SendExpiringCertificateNotificationEmailActionTest {
}
@TestOfyAndSql
void run_responseStatusIs200() {
void run_sentZeroEmail_responseStatusIs200() {
action.run();
assertThat(response.getStatus()).isEqualTo(SC_OK);
assertThat(response.getPayload())
.isEqualTo("Done. Sent 0 expiring certificate notification emails in total.");
}
@TestOfyAndSql
void run_sentEmails_responseStatusIs200() throws Exception {
for (int i = 1; i <= 5; i++) {
persistResource(
createRegistrar(
"id_" + i,
"name" + i,
SelfSignedCaCertificate.create(
"www.example.tld",
DateTime.parse("2020-09-02T00:00:00Z"),
DateTime.parse("2021-06-01T00:00:00Z"))
.cert(),
null)
.build());
}
action.run();
assertThat(response.getStatus()).isEqualTo(SC_OK);
assertThat(response.getPayload())
.isEqualTo("Done. Sent 5 expiring certificate notification emails in total.");
}
/** Returns a sample registrar with a customized registrar name, client id and certificate* */