20
20
21
21
import pytest
22
22
23
- from umapi_client import IdentityTypes
23
+ from umapi_client import IdentityTypes , GroupTypes , RoleTypes
24
24
from umapi_client import UserAction
25
25
26
26
@@ -31,7 +31,9 @@ def test_user_emptyid():
31
31
32
32
def test_user_adobeid ():
33
33
user = UserAction (
email = "[email protected] " )
34
- assert user .
wire_dict ()
== {
"do" : [],
"user" :
"[email protected] " }
34
+ assert user .wire_dict () == {"do" : [],
35
+
36
+ "useAdobeID" : True }
35
37
36
38
37
39
def test_user_enterpriseid ():
@@ -58,7 +60,8 @@ def test_create_user_adobeid():
58
60
user = UserAction (
email = "[email protected] " )
59
61
user .create ()
60
62
assert user .
wire_dict ()
== {
"do" : [{
"addAdobeID" : {
"email" :
"[email protected] " }}],
61
-
63
+
64
+ "useAdobeID" : True }
62
65
63
66
64
67
def test_create_user_adobeid_country ():
@@ -138,31 +141,44 @@ def test_add_product_federatedid():
138
141
139
142
140
143
144
+ def test_add_usergroup_federatedid ():
145
+ user = UserAction (
id_type = IdentityTypes .
federatedID ,
email = "[email protected] " )
146
+ user .add_group (groups = ["Photoshop" , "Illustrator" ], group_type = GroupTypes .usergroup )
147
+ assert user .wire_dict () == {"do" : [{"add" : {"usergroup" : ["Photoshop" , "Illustrator" ]}}],
148
+
149
+
150
+
141
151
def test_remove_product_federatedid ():
142
152
user = UserAction (
id_type = IdentityTypes .
federatedID ,
email = "[email protected] " )
143
- user .remove_group (groups = ["Photoshop" , "Illustrator" ])
153
+ user .remove_group (groups = ["Photoshop" , "Illustrator" ], group_type = "product" )
144
154
assert user .wire_dict () == {"do" : [{"remove" : {"product" : ["Photoshop" , "Illustrator" ]}}],
145
155
146
156
147
157
148
- def test_remove_product_federatedid_all ():
158
+ def test_remove_groups_federatedid_all ():
149
159
user = UserAction (
id_type = 'federatedID' ,
email = "[email protected] " )
150
160
user .remove_group (all_groups = True )
151
161
assert user .wire_dict () == {"do" : [{"remove" : "all" }],
152
162
153
163
154
164
165
+ def test_remove_groups_federatedid_all_error ():
166
+ user = UserAction (
id_type = 'federatedID' ,
email = "[email protected] " )
167
+ with pytest .raises (ValueError ):
168
+ user .remove_group (all_groups = True , group_type = "usergroup" )
169
+
170
+
155
171
def test_add_role_enterpriseid ():
156
172
user = UserAction (
id_type = IdentityTypes .
enterpriseID ,
email = "[email protected] " )
157
- user .add_role (groups = ["Photoshop" , "Illustrator" ])
173
+ user .add_role (groups = ["Photoshop" , "Illustrator" ], role_type = RoleTypes . admin )
158
174
assert user .wire_dict () == {"do" : [{"addRoles" : {"admin" : ["Photoshop" , "Illustrator" ]}}],
159
175
160
176
161
177
162
178
def test_remove_role_enterpriseid ():
163
179
user = UserAction (
id_type = 'enterpriseID' ,
email = "[email protected] " )
164
- user .remove_role (groups = ["Photoshop" , "Illustrator" ])
165
- assert user .wire_dict () == {"do" : [{"removeRoles" : {"admin " : ["Photoshop" , "Illustrator" ]}}],
180
+ user .remove_role (groups = ["Photoshop" , "Illustrator" ], role_type = "productAdmin" )
181
+ assert user .wire_dict () == {"do" : [{"removeRoles" : {"productAdmin " : ["Photoshop" , "Illustrator" ]}}],
166
182
167
183
168
184
@@ -177,13 +193,14 @@ def test_remove_from_organization_adobeid():
177
193
user = UserAction (
id_type = 'adobeID' ,
email = "[email protected] " )
178
194
user .remove_from_organization ()
179
195
assert user .wire_dict () == {"do" : [{"removeFromOrg" : {}}],
180
-
196
+
197
+ "useAdobeID" : True }
181
198
182
199
183
200
def test_remove_from_organization_delete_federatedid ():
184
201
user = UserAction (
id_type = IdentityTypes .
federatedID ,
email = "[email protected] " )
185
202
user .remove_from_organization (delete_account = True )
186
- assert user .wire_dict () == {"do" : [{"removeFromOrg" : {"removedDomain " : "k.on-the-side.net" }}],
203
+ assert user .wire_dict () == {"do" : [{"removeFromOrg" : {}}, { "removeFromDomain " : { }}],
187
204
188
205
189
206
@@ -196,7 +213,7 @@ def test_remove_from_organization_delete_adobeid():
196
213
def test_delete_account_enterpriseid ():
197
214
user = UserAction (
id_type = IdentityTypes .
enterpriseID ,
email = "[email protected] " )
198
215
user .delete_account ()
199
- assert user .wire_dict () == {"do" : [{"removeFromDomain" : {"domain" : "o.on-the-side.net" }}],
216
+ assert user .wire_dict () == {"do" : [{"removeFromDomain" : {}}],
200
217
201
218
202
219
0 commit comments