mirror of
https://github.com/google/nomulus.git
synced 2025-06-28 23:33:36 +02:00
Refactor a few new XsrfTokenManager methods
Followup to comments on [] ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=148792464
This commit is contained in:
parent
822cbc0494
commit
726e925b4a
5 changed files with 28 additions and 61 deletions
|
@ -383,7 +383,7 @@ public final class RequestHandlerTest {
|
|||
userService.setUser(testUser, false);
|
||||
when(req.getMethod()).thenReturn("POST");
|
||||
when(req.getHeader("X-CSRF-Token"))
|
||||
.thenReturn(xsrfTokenManager.generateTokenWithCurrentUser("vampire"));
|
||||
.thenReturn(xsrfTokenManager.generateToken("vampire", testUser.getEmail()));
|
||||
when(req.getRequestURI()).thenReturn("/safe-sloth");
|
||||
handler.handleRequest(req, rsp);
|
||||
verify(safeSlothTask).run();
|
||||
|
@ -394,7 +394,7 @@ public final class RequestHandlerTest {
|
|||
userService.setUser(testUser, false);
|
||||
when(req.getMethod()).thenReturn("POST");
|
||||
when(req.getHeader("X-CSRF-Token"))
|
||||
.thenReturn(xsrfTokenManager.generateTokenWithCurrentUser("blood"));
|
||||
.thenReturn(xsrfTokenManager.generateToken("blood", testUser.getEmail()));
|
||||
when(req.getRequestURI()).thenReturn("/safe-sloth");
|
||||
handler.handleRequest(req, rsp);
|
||||
verify(rsp).sendError(403, "Invalid X-CSRF-Token");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue