2020
2121import pytest
2222
23- from umapi_client import IdentityTypes
23+ from umapi_client import IdentityTypes , GroupTypes , RoleTypes
2424from umapi_client import UserAction
2525
2626
@@ -31,7 +31,9 @@ def test_user_emptyid():
3131
3232def test_user_adobeid ():
3333 user = UserAction (
email = "[email protected] " )
34- assert user .
wire_dict ()
== {
"do" : [],
"user" :
"[email protected] " }
34+ assert user .wire_dict () == {"do" : [],
35+ 36+ "useAdobeID" : True }
3537
3638
3739def test_user_enterpriseid ():
@@ -58,7 +60,8 @@ def test_create_user_adobeid():
5860 user = UserAction (
email = "[email protected] " )
5961 user .create ()
6062 assert user .
wire_dict ()
== {
"do" : [{
"addAdobeID" : {
"email" :
"[email protected] " }}],
61- 63+ 64+ "useAdobeID" : True }
6265
6366
6467def test_create_user_adobeid_country ():
@@ -138,31 +141,44 @@ def test_add_product_federatedid():
138141139142
140143
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+
141151def test_remove_product_federatedid ():
142152 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" )
144154 assert user .wire_dict () == {"do" : [{"remove" : {"product" : ["Photoshop" , "Illustrator" ]}}],
145155146156
147157
148- def test_remove_product_federatedid_all ():
158+ def test_remove_groups_federatedid_all ():
149159 user = UserAction (
id_type = 'federatedID' ,
email = "[email protected] " )
150160 user .remove_group (all_groups = True )
151161 assert user .wire_dict () == {"do" : [{"remove" : "all" }],
152162153163
154164
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+
155171def test_add_role_enterpriseid ():
156172 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 )
158174 assert user .wire_dict () == {"do" : [{"addRoles" : {"admin" : ["Photoshop" , "Illustrator" ]}}],
159175160176
161177
162178def test_remove_role_enterpriseid ():
163179 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" ]}}],
166182167183
168184
@@ -177,13 +193,14 @@ def test_remove_from_organization_adobeid():
177193 user = UserAction (
id_type = 'adobeID' ,
email = "[email protected] " )
178194 user .remove_from_organization ()
179195 assert user .wire_dict () == {"do" : [{"removeFromOrg" : {}}],
180- 196+ 197+ "useAdobeID" : True }
181198
182199
183200def test_remove_from_organization_delete_federatedid ():
184201 user = UserAction (
id_type = IdentityTypes .
federatedID ,
email = "[email protected] " )
185202 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 " : { }}],
187204188205
189206
@@ -196,7 +213,7 @@ def test_remove_from_organization_delete_adobeid():
196213def test_delete_account_enterpriseid ():
197214 user = UserAction (
id_type = IdentityTypes .
enterpriseID ,
email = "[email protected] " )
198215 user .delete_account ()
199- assert user .wire_dict () == {"do" : [{"removeFromDomain" : {"domain" : "o.on-the-side.net" }}],
216+ assert user .wire_dict () == {"do" : [{"removeFromDomain" : {}}],
200217201218
202219
0 commit comments