55import static org .junit .jupiter .api .Assertions .assertEquals ;
66
77import app .fyreplace .api .data .Email ;
8- import app .fyreplace .api .data .EmailActivation ;
8+ import app .fyreplace .api .data .EmailVerification ;
99import app .fyreplace .api .data .RandomCode ;
1010import app .fyreplace .api .data .User ;
1111import app .fyreplace .api .endpoints .EmailsEndpoint ;
2323
2424@ QuarkusTest
2525@ TestHTTPEndpoint (EmailsEndpoint .class )
26- public final class ActivateEmailTests extends UserTestsBase {
26+ public final class VerifyEmailTests extends UserTestsBase {
2727 @ Inject
2828 RandomService randomService ;
2929
@@ -33,53 +33,53 @@ public final class ActivateEmailTests extends UserTestsBase {
3333
3434 @ Test
3535 @ TestSecurity (user = "user_0" )
36- public void activateEmail () {
36+ public void verifyEmail () {
3737 given ().contentType (ContentType .JSON )
38- .body (new EmailActivation (newEmail .email , randomCodeClearText ))
39- .post ("activate " )
38+ .body (new EmailVerification (newEmail .email , randomCodeClearText ))
39+ .post ("verify " )
4040 .then ()
4141 .statusCode (200 );
4242 assertEquals (0 , RandomCode .count ("id" , randomCode .id ));
4343 }
4444
4545 @ Test
4646 @ TestSecurity (user = "user_0" )
47- public void activateEmailWithInvalidEmail () {
47+ public void verifyEmailWithInvalidEmail () {
4848 given ().contentType (ContentType .JSON )
49- .body (new EmailActivation ("invalid" , randomCodeClearText ))
50- .post ("activate " )
49+ .body (new EmailVerification ("invalid" , randomCodeClearText ))
50+ .post ("verify " )
5151 .then ()
5252 .statusCode (400 );
5353 assertEquals (1 , RandomCode .count ("id" , randomCode .id ));
5454 }
5555
5656 @ Test
5757 @ TestSecurity (user = "user_0" )
58- public void activateEmailWithOtherEmail () {
58+ public void verifyEmailWithOtherEmail () {
5959 final var otherUser = requireNonNull (User .findByUsername ("user_1" ));
6060 given ().contentType (ContentType .JSON )
61- .body (new EmailActivation (otherUser .mainEmail .email , randomCodeClearText ))
62- .post ("activate " )
61+ .body (new EmailVerification (otherUser .mainEmail .email , randomCodeClearText ))
62+ .post ("verify " )
6363 .then ()
6464 .statusCode (404 );
6565 assertEquals (1 , RandomCode .count ("id" , randomCode .id ));
6666 }
6767
6868 @ Test
6969 @ TestSecurity (user = "user_0" )
70- public void activateEmailWithInvalidCode () {
70+ public void verifyEmailWithInvalidCode () {
7171 given ().contentType (ContentType .JSON )
72- .body (new EmailActivation (newEmail .email , "invalid" ))
73- .post ("activate " )
72+ .body (new EmailVerification (newEmail .email , "invalid" ))
73+ .post ("verify " )
7474 .then ()
7575 .statusCode (404 );
7676 assertEquals (1 , RandomCode .count ("id" , randomCode .id ));
7777 }
7878
7979 @ Test
8080 @ TestSecurity (user = "user_0" )
81- public void activateEmailWithEmptyInput () {
82- given ().contentType (ContentType .JSON ).post ("activate " ).then ().statusCode (400 );
81+ public void verifyEmailWithEmptyInput () {
82+ given ().contentType (ContentType .JSON ).post ("verify " ).then ().statusCode (400 );
8383 assertEquals (1 , RandomCode .count ("id" , randomCode .id ));
8484 }
8585
0 commit comments