mirror of https://github.com/usbharu/Hideout.git
test: OAuth2でのトークン作成のテストを追加
This commit is contained in:
parent
aff9b68480
commit
c1c2e1e843
|
@ -40,3 +40,7 @@ spring:
|
||||||
# excluded-packages: dev.usbharu.hideout.core.infrastructure.kjobexposed
|
# excluded-packages: dev.usbharu.hideout.core.infrastructure.kjobexposed
|
||||||
server:
|
server:
|
||||||
port: 8080
|
port: 8080
|
||||||
|
tomcat:
|
||||||
|
basedir: tomcat-e2e
|
||||||
|
accesslog:
|
||||||
|
enabled: true
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||||
|
<file>./e2eTest.log</file>
|
||||||
|
<encoder>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%X{x-request-id}] %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%X{x-request-id}] %logger{36} - %msg%n</pattern>
|
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%X{x-request-id}] %logger{36} - %msg%n</pattern>
|
||||||
|
@ -6,6 +13,7 @@
|
||||||
</appender>
|
</appender>
|
||||||
<root level="TRACE">
|
<root level="TRACE">
|
||||||
<appender-ref ref="STDOUT"/>
|
<appender-ref ref="STDOUT"/>
|
||||||
|
<appender-ref ref="FILE"/>
|
||||||
</root>
|
</root>
|
||||||
<logger name="org.springframework.security" level="TRACE"/>
|
<logger name="org.springframework.security" level="TRACE"/>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
@ -10,7 +10,7 @@ Feature: OAuth2 Login Test
|
||||||
"""
|
"""
|
||||||
{
|
{
|
||||||
"client_name": "oauth2-test-client-1",
|
"client_name": "oauth2-test-client-1",
|
||||||
"redirect_uris": "https://example.com",
|
"redirect_uris": "https://usbharu.dev",
|
||||||
"scopes": "write read"
|
"scopes": "write read"
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
@ -23,10 +23,28 @@ Feature: OAuth2 Login Test
|
||||||
* def client_id = response.client_id
|
* def client_id = response.client_id
|
||||||
* def client_secret = response.client_secret
|
* def client_secret = response.client_secret
|
||||||
|
|
||||||
* def authorizeEndpoint = baseUrl + '/oauth/authorize?response_type=code&redirect_uri=https://example.com&client_id=' + client_id + '&scope=write read'
|
* def authorizeEndpoint = baseUrl + '/oauth/authorize?response_type=code&redirect_uri=https://usbharu.dev&client_id=' + client_id + '&scope=write%20read'
|
||||||
|
|
||||||
Given driver authorizeEndpoint
|
Given driver authorizeEndpoint
|
||||||
And driver.input('#username','test-user')
|
And driver.input('#username','test-user')
|
||||||
And driver.input('#password','password')
|
And driver.input('#password','password')
|
||||||
|
|
||||||
When driver.submit().click('body > div > form > button')
|
When driver.submit().click('body > div > form > button')
|
||||||
Then match driver.title == 'test'
|
Then driver.waitForUrl(authorizeEndpoint + "&continue")
|
||||||
|
And driver.click('#read')
|
||||||
|
And driver.click('#write')
|
||||||
|
|
||||||
|
When driver.submit().click('#submit-consent')
|
||||||
|
Then driver.waitUntil("location.host == 'usbharu.dev'")
|
||||||
|
|
||||||
|
* def code = script("new URLSearchParams(document.location.search).get('code')")
|
||||||
|
|
||||||
|
Given path '/oauth/token'
|
||||||
|
And form field client_id = client_id
|
||||||
|
And form field client_secret = client_secret
|
||||||
|
And form field redirect_uri = 'https://usbharu.dev'
|
||||||
|
And form field grant_type = 'authorization_code'
|
||||||
|
And form field code = code
|
||||||
|
And form field scope = 'write read'
|
||||||
|
When method post
|
||||||
|
Then status 200
|
||||||
|
|
Loading…
Reference in New Issue