test passing no url still work
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1342594 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2cec177b0c
commit
0e9c6a219c
|
@ -179,6 +179,65 @@ public class UserServiceTest
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void registerNoUrl()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UserService service = getUserService();
|
||||||
|
User u = new User();
|
||||||
|
u.setFullName( "the toto" );
|
||||||
|
u.setUsername( "toto" );
|
||||||
|
u.setEmail( "toto@toto.fr" );
|
||||||
|
u.setPassword( "toto123" );
|
||||||
|
u.setConfirmPassword( "toto123" );
|
||||||
|
String key = service.registerUser( new UserRegistrationRequest( u, null ) ).getKey();
|
||||||
|
|
||||||
|
assertFalse( key.equals( "-1" ) );
|
||||||
|
|
||||||
|
ServicesAssert assertService =
|
||||||
|
JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/testsService/",
|
||||||
|
ServicesAssert.class,
|
||||||
|
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
|
||||||
|
|
||||||
|
List<EmailMessage> emailMessages = assertService.getEmailMessageSended();
|
||||||
|
assertEquals( 1, emailMessages.size() );
|
||||||
|
assertEquals( "toto@toto.fr", emailMessages.get( 0 ).getTos().get( 0 ) );
|
||||||
|
|
||||||
|
assertEquals( "Welcome", emailMessages.get( 0 ).getSubject() );
|
||||||
|
String messageContent = emailMessages.get( 0 ).getText();
|
||||||
|
|
||||||
|
log.info( "messageContent: {}", messageContent );
|
||||||
|
|
||||||
|
assertThat( messageContent ).contains( "Use the following URL to validate your account." ).contains(
|
||||||
|
"http://localhost:" + port ).containsIgnoringCase( "toto" );
|
||||||
|
|
||||||
|
assertTrue( service.validateUserFromKey( key ) );
|
||||||
|
|
||||||
|
service = getUserService( authorizationHeader );
|
||||||
|
|
||||||
|
u = service.getUser( "toto" );
|
||||||
|
|
||||||
|
assertNotNull( u );
|
||||||
|
assertTrue( u.isValidated() );
|
||||||
|
assertTrue( u.isPasswordChangeRequired() );
|
||||||
|
|
||||||
|
assertTrue( service.validateUserFromKey( key ) );
|
||||||
|
|
||||||
|
}
|
||||||
|
catch ( Exception e )
|
||||||
|
{
|
||||||
|
log.error( e.getMessage(), e );
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
getUserService( authorizationHeader ).deleteUser( "toto" );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void resetPassword()
|
public void resetPassword()
|
||||||
throws Exception
|
throws Exception
|
||||||
|
|
Loading…
Reference in New Issue