Skip to content

Commit 4f3538d

Browse files
committed
fix(admin-ui): write test for Openid connect client pages #295
1 parent 237a3a5 commit 4f3538d

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import React from 'react'
2+
import { render, screen } from '@testing-library/react'
3+
import ClientDetailPage from './ClientDetailPage'
4+
import i18n from '../../../../app/i18n'
5+
import { I18nextProvider } from 'react-i18next'
6+
7+
const Wrapper = ({ children }) => (
8+
<I18nextProvider i18n={i18n}>{children}</I18nextProvider>
9+
)
10+
const permissions = [
11+
'https://jans.io/oauth/config/openid/clients.readonly',
12+
'https://jans.io/oauth/config/openid/clients.write',
13+
'https://jans.io/oauth/config/openid/clients.delete',
14+
]
15+
const row = {
16+
applicationType: 'web',
17+
includeClaimsInIdToken: false,
18+
dn: 'inum=2073c8e7-1060-4c09-b0f6-7d46fb6ff8f5,ou=clients,o=jans',
19+
inum: '2073c8e7-1060-4c09-b0f6-7d46fb6ff8f5',
20+
clientSecret: '92bc4d8e-2f4c-4a4d-80ae-1e4eb1f5f463',
21+
frontChannelLogoutUri: 'http://localhost:4100/logout',
22+
frontChannelLogoutSessionRequired: false,
23+
registrationAccessToken: 'de5aaa9c-d6b4-44a1-912f-40c97063544a',
24+
clientIdIssuedAt: '2021-07-28T06:35:09.000Z',
25+
redirectUris: [
26+
'http://localhost:4100',
27+
'https://admin-ui-test.gluu.org/admin',
28+
],
29+
responseTypes: ['code'],
30+
grantTypes: ['authorization_code', 'refresh_token', 'client_credentials'],
31+
clientName: 'admin-ui',
32+
subjectType: 'pairwise',
33+
idTokenSignedResponseAlg: 'RS256',
34+
userInfoSignedResponseAlg: 'RS256',
35+
tokenEndpointAuthMethod: 'client_secret_basic',
36+
requireAuthTime: false,
37+
defaultAcrValues: ['simple_password_auth'],
38+
postLogoutRedirectUris: [
39+
'http://localhost:4100',
40+
'https://admin-ui-test.gluu.org/admin',
41+
],
42+
scopes: [
43+
'inum=F0C4,ou=scopes,o=jans',
44+
'inum=6D90,ou=scopes,o=jans',
45+
'inum=43F1,ou=scopes,o=jans',
46+
],
47+
trustedClient: false,
48+
lastAccessTime: '2021-07-28T06:35:09.000Z',
49+
lastLogonTime: '2021-07-28T06:35:09.000Z',
50+
persistClientAuthorizations: true,
51+
customAttributes: [],
52+
customObjectClasses: ['top'],
53+
rptAsJwt: false,
54+
accessTokenAsJwt: true,
55+
accessTokenSigningAlg: 'RS256',
56+
disabled: false,
57+
attributes: {
58+
runIntrospectionScriptBeforeAccessTokenAsJwtCreationAndIncludeClaims: false,
59+
keepClientAuthorizationAfterExpiration: false,
60+
allowSpontaneousScopes: false,
61+
backchannelLogoutSessionRequired: false,
62+
},
63+
deletable: false,
64+
}
65+
it('Should the client detail page properly properly', () => {
66+
render(<ClientDetailPage row={row} scopes={permissions} />, {
67+
wrapper: Wrapper,
68+
})
69+
screen.getByText(/2073c8e7-1060-4c09-b0f6-7d46fb6ff8f5/)
70+
screen.getByText('admin-ui')
71+
screen.getByText('pairwise')
72+
screen.getByText(/The openid connect client name/)
73+
})

plugins/auth-server/components/Clients/ClientEditPage.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ const Wrapper = ({ children }) => (
175175
)
176176
const emptyArray = []
177177

178-
it('Should the client edit page properly properly', () => {
178+
it('Should the client edit page properly', () => {
179179
render(
180180
<ClientEditPage
181181
scopes={scopes}

0 commit comments

Comments
 (0)