-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed endpoint error handling and minor fixes
- Loading branch information
Showing
5 changed files
with
15 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ import pt.up.fe.ni.website.backend.model.Account | |
import pt.up.fe.ni.website.backend.model.CustomWebsite | ||
import pt.up.fe.ni.website.backend.model.constants.AccountConstants | ||
import pt.up.fe.ni.website.backend.repository.AccountRepository | ||
import pt.up.fe.ni.website.backend.service.ErrorMessages | ||
import pt.up.fe.ni.website.backend.utils.TestUtils | ||
import pt.up.fe.ni.website.backend.utils.ValidationTester | ||
import pt.up.fe.ni.website.backend.utils.annotations.ControllerTest | ||
|
@@ -204,18 +205,17 @@ class AuthControllerTest @Autowired constructor( | |
} | ||
|
||
@Test | ||
fun `should fail if email is not found`() { | ||
fun `should return empty if email is not found`() { | ||
mockMvc.perform( | ||
post("/auth/password/recovery") | ||
.contentType(MediaType.APPLICATION_JSON) | ||
.content(objectMapper.writeValueAsString(mapOf("email" to "[email protected]"))) | ||
) | ||
.andExpectAll( | ||
status().isNotFound(), | ||
jsonPath("$.errors.length()").value(1), | ||
jsonPath("$.errors[0].message").value("account not found with email [email protected]") | ||
status().isOk(), | ||
jsonPath("$.recovery_url").doesNotExist() | ||
) | ||
.andDocumentErrorResponse( | ||
.andDocument( | ||
documentation, | ||
"Recover password", | ||
"This endpoint operation allows the recovery of the password of an account, " + | ||
|
@@ -402,7 +402,7 @@ class AuthControllerTest @Autowired constructor( | |
).andExpectAll( | ||
status().isUnauthorized(), | ||
jsonPath("$.errors.length()").value(1), | ||
jsonPath("$.errors[0].message").value("invalid password recovery token") | ||
jsonPath("$.errors[0].message").value(ErrorMessages.expiredRecoveryToken) | ||
).andDocumentCustomRequestSchemaErrorResponse( | ||
documentation, | ||
passwordRecoveryPayload, | ||
|
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