Skip to content

Commit a638140

Browse files
committed
Adds user profile tests
1 parent 966d517 commit a638140

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

tests/security/130_user_profile.yml

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
requires:
3+
stack: true
4+
serverless: false
5+
---
6+
setup:
7+
- do:
8+
security.put_user:
9+
username: "juan"
10+
body: >
11+
{
12+
"password" : "s3krit-password",
13+
"roles" : [ "superuser" ],
14+
"full_name" : "Juan Pérez",
15+
"email" : "juan@bazooka.gum"
16+
}
17+
---
18+
teardown:
19+
- do:
20+
security.delete_user:
21+
username: "juan"
22+
ignore: 404
23+
---
24+
"Security User Profiles":
25+
- do:
26+
security.activate_user_profile:
27+
body: >
28+
{
29+
"grant_type": "password",
30+
"username": "juan",
31+
"password" : "s3krit-password"
32+
}
33+
- set: { uid: profile_uid }
34+
35+
# enabled right after activation
36+
- do:
37+
security.get_user_profile:
38+
uid: "$profile_uid"
39+
- set: { profiles.0: profile }
40+
- is_true: "$profile.enabled"
41+
42+
# disable the profile
43+
- do:
44+
security.disable_user_profile:
45+
uid: "$profile_uid"
46+
- do:
47+
security.get_user_profile:
48+
uid: "$profile_uid"
49+
- set: { profiles.0: profile }
50+
- is_false: "$profile.enabled"
51+
52+
# enable again
53+
- do:
54+
security.enable_user_profile:
55+
uid: "$profile_uid"
56+
- do:
57+
security.get_user_profile:
58+
uid: "$profile_uid"
59+
- set: { profiles.0: profile }
60+
- is_true: "$profile.enabled"
61+
62+
- do:
63+
security.has_privileges_user_profile:
64+
body:
65+
uids:
66+
- $profile_uid
67+
privileges:
68+
index:
69+
- names:
70+
- index1*
71+
privileges:
72+
- read
73+
- is_true: has_privilege_uids
74+
75+
- do:
76+
security.suggest_user_profiles:
77+
body: >
78+
{
79+
"name": "juan",
80+
"size": 5,
81+
"hint": {
82+
"labels": {
83+
"direction": ["north", "east"]
84+
}
85+
}
86+
}
87+
# None of the hints matches. But name match is sufficient
88+
- length: { profiles: 1 }
89+
90+
- do:
91+
security.update_user_profile_data:
92+
uid: "$profile_uid"
93+
body: >
94+
{
95+
"labels": {
96+
"kibana": {
97+
"spaces": "demo"
98+
}
99+
}
100+
}
101+
- is_true: acknowledged

0 commit comments

Comments
 (0)