forked from Archives/Athou_commafeed
add test for password recovery
This commit is contained in:
@@ -37,6 +37,7 @@ app:
|
||||
smtpTls: false
|
||||
smtpUserName: user
|
||||
smtpPassword: pass
|
||||
smtpFromAddress:
|
||||
|
||||
# Graphite Metric settings
|
||||
# Allows those who use Graphite to have CommaFeed send metrics for graphing (time in seconds)
|
||||
|
||||
@@ -452,6 +452,12 @@
|
||||
<version>5.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.icegreen</groupId>
|
||||
<artifactId>greenmail-junit5</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- dropwizard pulls bouncycastle 1.76 but mockserver pulls 1.72, causing NoSuchFieldError on BCObjectIdentifiers.sphincsPlus_shake_256 -->
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.commafeed.integration.rest;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
import com.commafeed.frontend.model.request.PasswordResetRequest;
|
||||
import com.commafeed.integration.BaseIT;
|
||||
import com.icegreen.greenmail.junit5.GreenMailExtension;
|
||||
import com.icegreen.greenmail.util.ServerSetupTest;
|
||||
|
||||
import jakarta.mail.internet.MimeMessage;
|
||||
import jakarta.ws.rs.client.Entity;
|
||||
|
||||
class UserIT extends BaseIT {
|
||||
|
||||
@Nested
|
||||
class PasswordReset {
|
||||
|
||||
@RegisterExtension
|
||||
static final GreenMailExtension GREEN_MAIL = new GreenMailExtension(ServerSetupTest.SMTP);
|
||||
|
||||
@BeforeEach
|
||||
void init() {
|
||||
GREEN_MAIL.setUser("noreply@commafeed.com", "user", "pass");
|
||||
}
|
||||
|
||||
@Test
|
||||
void resetPassword() throws Exception {
|
||||
PasswordResetRequest req = new PasswordResetRequest();
|
||||
req.setEmail("admin@commafeed.com");
|
||||
|
||||
getClient().target(getApiBaseUrl() + "user/passwordReset").request().post(Entity.json(req), Void.TYPE);
|
||||
|
||||
MimeMessage message = GREEN_MAIL.getReceivedMessages()[0];
|
||||
Assertions.assertEquals("CommaFeed - Password recovery", message.getSubject());
|
||||
Assertions.assertTrue(message.getContent().toString().startsWith("You asked for password recovery for account 'admin'"));
|
||||
Assertions.assertEquals("CommaFeed <noreply@commafeed.com>", message.getFrom()[0].toString());
|
||||
Assertions.assertEquals("admin@commafeed.com", message.getAllRecipients()[0].toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,10 +33,11 @@ app:
|
||||
|
||||
# settings for sending emails (password recovery)
|
||||
smtpHost: localhost
|
||||
smtpPort: 25
|
||||
smtpPort: 3025
|
||||
smtpTls: false
|
||||
smtpUserName: user
|
||||
smtpPassword: pass
|
||||
smtpFromAddress: noreply@commafeed.com
|
||||
|
||||
# Graphite Metric settings
|
||||
# Allows those who use Graphite to have CommaFeed send metrics for graphing (time in seconds)
|
||||
|
||||
Reference in New Issue
Block a user