-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Update to send email): Sends accept depentent email to relat…
…ed user on create/update if app
- Loading branch information
Showing
6 changed files
with
64 additions
and
12 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
43 changes: 43 additions & 0 deletions
43
src/test/java/org/opentripplanner/middleware/tripmonitor/TrustedCompanionTest.java
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,43 @@ | ||
package org.opentripplanner.middleware.tripmonitor; | ||
|
||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
import org.opentripplanner.middleware.models.OtpUser; | ||
import org.opentripplanner.middleware.models.RelatedUser; | ||
import org.opentripplanner.middleware.persistence.Persistence; | ||
import org.opentripplanner.middleware.testutils.ApiTestUtils; | ||
import org.opentripplanner.middleware.testutils.OtpMiddlewareTestEnvironment; | ||
import org.opentripplanner.middleware.testutils.PersistenceTestUtils; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.opentripplanner.middleware.auth.Auth0Connection.setAuthDisabled; | ||
import static org.opentripplanner.middleware.testutils.PersistenceTestUtils.deleteOtpUser; | ||
|
||
public class TrustedCompanionTest extends OtpMiddlewareTestEnvironment { | ||
private static OtpUser relatedUserOne; | ||
private static OtpUser dependentUserOne; | ||
|
||
@BeforeAll | ||
public static void setUp() { | ||
setAuthDisabled(false); | ||
relatedUserOne = PersistenceTestUtils.createUser(ApiTestUtils.generateEmailAddress("related-user-one")); | ||
dependentUserOne = PersistenceTestUtils.createUser(ApiTestUtils.generateEmailAddress("dependent-one")); | ||
} | ||
|
||
@AfterAll | ||
public static void tearDown() { | ||
deleteOtpUser(IS_END_TO_END, | ||
relatedUserOne, | ||
dependentUserOne | ||
); | ||
} | ||
|
||
@Test | ||
void canManageAcceptDependentEmail() { | ||
dependentUserOne.relatedUsers.add(new RelatedUser(relatedUserOne.id, relatedUserOne.email, RelatedUser.RelatedUserStatus.PENDING)); | ||
Persistence.otpUsers.replace(dependentUserOne.id, dependentUserOne); | ||
TrustedCompanion.manageAcceptDependentEmail(dependentUserOne, true); | ||
assertTrue(dependentUserOne.relatedUsers.get(0).acceptDependentEmailSent); | ||
} | ||
} |