-
Notifications
You must be signed in to change notification settings - Fork 314
Expand file tree
/
Copy pathuser-attribute-profiles.test.ts
More file actions
118 lines (101 loc) · 3.77 KB
/
user-attribute-profiles.test.ts
File metadata and controls
118 lines (101 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import {
ManagementClient,
UserAttributeProfilesManager,
GetUserAttributeProfilesByIdRequest,
CreateUserAttributeProfileRequestContent,
UpdateUserAttributeProfileRequestContent,
DeleteUserAttributeProfilesByIdRequest,
GetUserAttributeProfileTemplateRequest,
} from '../../src/index.js';
import { checkMethod } from './tests.util.js';
const DOMAIN = `tenant.auth0.com`;
const token = 'TOKEN';
describe('UserAttributeProfilesManager', () => {
const userAttributeProfilesManager: UserAttributeProfilesManager = new ManagementClient({
domain: DOMAIN,
token,
}).userAttributeProfiles;
// this is the test for the method userAttributeProfilesManager.getAll
describe('getAll', () => {
const operation = userAttributeProfilesManager.getAll();
const uri = `/user-attribute-profiles`;
const method = 'get';
checkMethod({ operation, uri, method });
});
// this is the test for the method userAttributeProfilesManager.get
describe('get', () => {
const requestParameters: GetUserAttributeProfilesByIdRequest = {
id: 'id',
};
const operation = userAttributeProfilesManager.get(requestParameters);
const uri = `/user-attribute-profiles/id`;
const method = 'get';
checkMethod({ operation, uri, method });
});
// this is the test for the method userAttributeProfilesManager.update
describe('update', () => {
const requestParameters: GetUserAttributeProfilesByIdRequest = {
id: 'id',
};
const updatePayload: UpdateUserAttributeProfileRequestContent = {
user_id: {
scim_mapping: 'customMappingValue',
saml_mapping: ['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier'],
oidc_mapping: 'sub',
},
};
const operation = userAttributeProfilesManager.update(requestParameters, updatePayload);
const uri = `/user-attribute-profiles/id`;
const method = 'patch';
checkMethod({ operation, uri, method });
});
// this is the test for the method userAttributeProfilesManager.create
describe('create', () => {
const createPayload: CreateUserAttributeProfileRequestContent = {
name: 'Test',
user_attributes: {
username: {
description: 'This is just a test',
label: 'testUser',
profile_required: false,
auth0_mapping: 'testUser',
oidc_mapping: {
mapping: 'preferred_username',
display_name: 'Display Name',
},
},
},
};
const operation = userAttributeProfilesManager.create(createPayload);
const uri = `/user-attribute-profiles`;
const method = 'post';
checkMethod({ operation, uri, method });
});
// this is the test for the method userAttributeProfilesManager.delete
describe('delete', () => {
const requestParameters: DeleteUserAttributeProfilesByIdRequest = {
id: 'id',
};
const operation = userAttributeProfilesManager.delete(requestParameters);
const uri = `/user-attribute-profiles/id`;
const method = 'delete';
checkMethod({ operation, uri, method });
});
// this is the test for the method userAttributeProfilesManager.getAllTemplates
describe('getAllTemplates', () => {
const operation = userAttributeProfilesManager.getAllTemplates();
const uri = `/user-attribute-profiles/templates`;
const method = 'get';
checkMethod({ operation, uri, method });
});
// this is the test for the method userAttributeProfilesManager.getTemplate
describe('getTemplate', () => {
const requestParameters: GetUserAttributeProfileTemplateRequest = {
id: 'id',
};
const operation = userAttributeProfilesManager.getTemplate(requestParameters);
const uri = `/user-attribute-profiles/templates/id`;
const method = 'get';
checkMethod({ operation, uri, method });
});
});