use of org.craftercms.profile.api.VerificationToken in project profile by craftercms.
the class ProfileServiceImplTest method testResetPassword.
@Test
public void testResetPassword() throws Exception {
Profile expected = getTenant1Profile();
expected.setAttributes(getAttributesWithoutPrivateAttribute());
Profile actual = profileService.resetPassword(PROFILE1_ID.toString(), RESET_PASSWORD_URL);
assertEqualProfiles(expected, actual);
VerificationToken token = new VerificationToken();
token.setId(VERIFICATION_TOKEN_ID1);
verify(tenantPermissionEvaluator).isAllowed(TENANT1_NAME, TenantAction.MANAGE_PROFILES.toString());
verify(profileRepository).findById(PROFILE1_ID.toString(), new String[0]);
verify(verificationService).createToken(actual);
verify(verificationService).sendEmail(token, actual, RESET_PASSWORD_URL, RESET_PASSWORD_FROM_ADDRESS, RESET_PASSWORD_SUBJECT, RESET_PASSWORD_TEMPLATE_NAME);
}
use of org.craftercms.profile.api.VerificationToken in project profile by craftercms.
the class ProfileServiceImplTest method testCreateVerificationToken.
@Test
public void testCreateVerificationToken() throws Exception {
VerificationToken token = profileService.createVerificationToken(PROFILE1_ID.toString());
assertNotNull(token);
assertEquals(VERIFICATION_TOKEN_ID1, token.getId());
assertEquals(TENANT1_NAME, token.getTenant());
assertEquals(PROFILE1_ID.toString(), token.getProfileId());
assertNotNull(token.getTimestamp());
verify(verificationService).createToken(getTenant1Profile());
}
use of org.craftercms.profile.api.VerificationToken in project profile by craftercms.
the class VerificationServiceImplTest method testSendEmail.
@Test
public void testSendEmail() throws Exception {
Profile profile = new Profile();
profile.setId(PROFILE_ID);
profile.setEmail(PROFILE_EMAIL);
VerificationToken token = new VerificationToken();
token.setId(TOKEN_ID);
verificationService.sendEmail(token, profile, VERIFICATION_BASE_URL, FROM, SUBJECT, TEMPLATE_NAME);
verify(emailFactory).getEmail(FROM, TO, null, null, SUBJECT, TEMPLATE_NAME, VERIFICATION_TEMPLATE_ARGS, true);
verify(email).send();
}
use of org.craftercms.profile.api.VerificationToken in project profile by craftercms.
the class VerificationServiceImplTest method getToken.
private VerificationToken getToken() {
VerificationToken token = new VerificationToken();
token.setId(TOKEN_ID);
token.setProfileId(PROFILE_ID.toString());
token.setTimestamp(new Date());
return token;
}
use of org.craftercms.profile.api.VerificationToken in project profile by craftercms.
the class VerificationServiceImplTest method testCreateToken.
@Test
public void testCreateToken() throws Exception {
Profile profile = new Profile();
profile.setId(PROFILE_ID);
profile.setTenant(TENANT_NAME);
VerificationToken token = verificationService.createToken(profile);
assertEquals(TOKEN_ID, token.getId());
assertEquals(TENANT_NAME, token.getTenant());
assertEquals(PROFILE_ID.toString(), token.getProfileId());
assertNotNull(token.getTimestamp());
verify(tokenRepository).insert(any(VerificationToken.class));
}
Aggregations