feat(frontend): hosted sign-in and OAuth settings for Cognito app clients
CI / checks (pull_request) Successful in 26m7s
CI / checks (pull_request) Successful in 26m7s
This commit is contained in:
@@ -747,6 +747,28 @@ describe('cloud schema routes', () => {
|
||||
])
|
||||
})
|
||||
|
||||
test('reads and updates an app client\'s OAuth settings', async () => {
|
||||
const settings = {clientId: 'c1', clientName: 'web', hasSecret: false, explicitAuthFlows: [], callbackUrls: [], logoutUrls: [], oauthFlows: [], oauthScopes: [], identityProviders: ['COGNITO']}
|
||||
const calls: unknown[] = []
|
||||
const app = appWithRoutes([mockAdapter('aws', {
|
||||
service: 'userpools',
|
||||
schema: awsUserPoolsSchema,
|
||||
describeUserPoolClient: async () => settings,
|
||||
updateUserPoolClientOAuth: async (poolId, clientId, input) => {
|
||||
calls.push([poolId, clientId, input])
|
||||
return {...settings, ...input}
|
||||
},
|
||||
})])
|
||||
const base = '/api/clouds/aws/services/userpools/resources/us-east-1_x/clients/c1'
|
||||
const input = {callbackUrls: ['http://localhost:4600/cb'], logoutUrls: [], oauthFlows: ['code'], oauthScopes: ['openid'], identityProviders: ['COGNITO']}
|
||||
|
||||
expect(await (await app.request(base)).json()).toEqual(settings)
|
||||
const updated = await app.request(`${base}/oauth`, {method: 'PUT', headers: {'content-type': 'application/json'}, body: JSON.stringify(input)})
|
||||
expect(updated.status).toBe(200)
|
||||
expect((await updated.json()).oauthFlows).toEqual(['code'])
|
||||
expect(calls).toEqual([['us-east-1_x', 'c1', input]])
|
||||
})
|
||||
|
||||
test('clears the SES mailbox through the email adapter', async () => {
|
||||
let cleared = false
|
||||
const app = appWithRoutes([mockAdapter('aws', {
|
||||
|
||||
Reference in New Issue
Block a user