공개 로그인 관리자 진입 개선
This commit is contained in:
@@ -62,6 +62,34 @@ test('정상 관리자 로그인은 서명된 세션 쿠키를 설정한다', as
|
||||
await api.dispose()
|
||||
})
|
||||
|
||||
test('공개 관리자 계정 로그인은 관리자 세션도 설정한다', async ({ baseURL }) => {
|
||||
const api = await request.newContext({ baseURL })
|
||||
const response = await api.post('/api/auth/login', {
|
||||
data: {
|
||||
email: adminEmail,
|
||||
password: initialPassword
|
||||
}
|
||||
})
|
||||
|
||||
expect(response.status()).toBe(200)
|
||||
expect(await response.json()).toMatchObject({
|
||||
email: adminEmail,
|
||||
isAdmin: true
|
||||
})
|
||||
expect(response.headers()['set-cookie']).toContain('sori_admin_session=')
|
||||
|
||||
const meResponse = await api.get('/admin/api/auth/me')
|
||||
expect(meResponse.status()).toBe(200)
|
||||
expect((await meResponse.json()).email).toBe(adminEmail)
|
||||
|
||||
const logoutResponse = await api.post('/api/auth/logout')
|
||||
expect(logoutResponse.status()).toBe(200)
|
||||
|
||||
const loggedOutMeResponse = await api.get('/admin/api/auth/me')
|
||||
expect(loggedOutMeResponse.status()).toBe(401)
|
||||
await api.dispose()
|
||||
})
|
||||
|
||||
test('설정 일부 PATCH는 전달하지 않은 필드를 보존한다', async () => {
|
||||
const beforeResponse = await adminApi.get('/admin/api/settings')
|
||||
expect(beforeResponse.status()).toBe(200)
|
||||
|
||||
Reference in New Issue
Block a user