-
-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes: #1889
- Loading branch information
Showing
3 changed files
with
21 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,8 @@ class SessionTest( | |
) { | ||
private lateinit var user: KomgaUser | ||
|
||
private val rememberMeCookieName = "komga-remember-me" | ||
|
||
@BeforeAll | ||
fun setup() { | ||
user = KomgaUser("[email protected]", "user") | ||
|
@@ -56,6 +58,23 @@ class SessionTest( | |
} | ||
} | ||
|
||
@Test | ||
fun `given remember-me parameter when hitting an endpoint then remember-me cookie is returned`() { | ||
mockMvc | ||
.get("/api/v2/users/me") { | ||
with(httpBasic(user.email, user.password)) | ||
param("remember-me", "true") | ||
}.andExpect { | ||
header { | ||
string(HttpHeaders.SET_COOKIE, containsString("$rememberMeCookieName=")) | ||
} | ||
cookie { | ||
exists(rememberMeCookieName) | ||
httpOnly(rememberMeCookieName, true) | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun `given valid basic credentials when providing the auth header then session is returned in headers`() { | ||
mockMvc | ||
|