Skip to content

Commit 3d186aa

Browse files
Merge pull request #69 from adobe-apiplatform/v2
umapi-client 2.12
2 parents e890045 + 1c446d7 commit 3d186aa

19 files changed

+102
-110
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016-2017 Adobe Systems Incorporated. All rights reserved.
3+
Copyright (c) 2016-2017 Adobe Inc. All rights reserved.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ which provides Adobe Enterprise customers the ability to manage their users. Th
88
client makes it easy to access the UMAPI from a local Python application.
99

1010
This client is open source, maintained by Adobe, and distributed under the terms
11-
of the OSI-approved MIT license. Copyright (c) 2016-2017 Adobe Systems Incorporated.
11+
of the OSI-approved MIT license. Copyright (c) 2016-2017 Adobe Inc.
1212

1313
# Installation
1414

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ which provides Adobe Enterprise customers the ability to manage their users. Th
88
client makes it easy to access the UMAPI from a local Python application.
99

1010
This client is open source, maintained by Adobe, and distributed under the terms
11-
of the OSI-approved MIT license. Copyright (c) 2016-2017 Adobe Systems Incorporated.
11+
of the OSI-approved MIT license. Copyright (c) 2016-2017 Adobe Inc.
1212

1313
# Installation
1414

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2016-2017 Adobe Systems Incorporated. All rights reserved.
1+
# Copyright (c) 2016-2017 Adobe Inc. All rights reserved.
22
#
33
# Permission is hereby granted, free of charge, to any person obtaining a copy
44
# of this software and associated documentation files (the "Software"), to deal
@@ -31,7 +31,7 @@
3131
'which provides Adobe Enterprise customers the ability to manage their users. This '
3232
'client makes it easy to access the UMAPI from a local Python application. '
3333
'This client is open source, maintained by Adobe, and distributed under the terms '
34-
'of the OSI-approved MIT license. Copyright (c) 2016-2017 Adobe Systems Incorporated.'),
34+
'of the OSI-approved MIT license. Copyright (c) 2016-2017 Adobe Inc.'),
3535
classifiers=[
3636
'Development Status :: 5 - Production/Stable',
3737
'Programming Language :: Python :: 2.7',

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2016-2017 Adobe Systems Incorporated. All rights reserved.
1+
# Copyright (c) 2016-2017 Adobe Inc. All rights reserved.
22
#
33
# Permission is hereby granted, free of charge, to any person obtaining a copy
44
# of this software and associated documentation files (the "Software"), to deal

tests/test_actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2016-2017 Adobe Systems Incorporated. All rights reserved.
1+
# Copyright (c) 2016-2017 Adobe Inc. All rights reserved.
22
#
33
# Permission is hereby granted, free of charge, to any person obtaining a copy
44
# of this software and associated documentation files (the "Software"), to deal

tests/test_connections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2016-2017 Adobe Systems Incorporated. All rights reserved.
1+
# Copyright (c) 2016-2017 Adobe Inc. All rights reserved.
22
#
33
# Permission is hereby granted, free of charge, to any person obtaining a copy
44
# of this software and associated documentation files (the "Software"), to deal

tests/test_functional.py

Lines changed: 66 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding: utf-8
22

3-
# Copyright (c) 2016-2017 Adobe Systems Incorporated. All rights reserved.
3+
# Copyright (c) 2016-2017 Adobe Inc. All rights reserved.
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal
@@ -51,23 +51,6 @@ def test_user_adobeid_unicode():
5151
"useAdobeID": True}
5252

5353

54-
def test_user_adobeid_unicode_error_unicode_dot_above():
55-
with pytest.raises(ValueError) as excinfo:
56-
UserAction(email=u"lwałę[email protected]")
57-
assert excinfo.type == ArgumentError
58-
if six.PY2:
59-
assert excinfo.match(u"lwałę[email protected]".encode('utf8'))
60-
with pytest.raises(ValueError) as excinfo:
61-
UserAction(email=u"lwałę[email protected]".encode('utf8'))
62-
assert excinfo.type == ArgumentError
63-
assert excinfo.match(u"lwałę[email protected]".encode('utf8'))
64-
65-
66-
def test_user_adobeid_unicode_error_trailing_dot():
67-
with pytest.raises(ValueError):
68-
UserAction(email=u"[email protected]")
69-
70-
7154
def test_user_enterpriseid():
7255
user = UserAction(id_type=IdentityTypes.enterpriseID, email="[email protected]")
7356
assert user.wire_dict() == {"do": [], "user": "[email protected]"}
@@ -88,11 +71,6 @@ def test_user_federatedid_username():
8871
assert user.wire_dict() == {"do": [], "user": "dbrotsky", "domain": "k.on-the-side.net"}
8972

9073

91-
def test_user_federatedid_username_unicode_error():
92-
with pytest.raises(ValueError):
93-
UserAction(id_type=IdentityTypes.federatedID, username=u"lwałęsa", domain="k.on-the-side.net")
94-
95-
9674
def test_create_user_adobeid():
9775
user = UserAction(email="[email protected]")
9876
user.create()
@@ -122,43 +100,55 @@ def test_create_user_enterpriseid():
122100

123101

124102
def test_create_user_federatedid():
125-
user = UserAction(id_type=IdentityTypes.federatedID, email="[email protected]")
126-
user.create(first_name="Daniel", last_name="Brotsky", country="US")
127-
assert user.wire_dict() == {"do": [{"createFederatedID": {"email": "[email protected]",
128-
"firstname": "Daniel", "lastname": "Brotsky",
103+
"""
104+
Test federated ID action with email address and no username
105+
"""
106+
user = UserAction(id_type=IdentityTypes.federatedID, email="[email protected]")
107+
user.create(first_name="Example", last_name="User", country="US")
108+
assert user.wire_dict() == {"do": [{"createFederatedID": {"email": "[email protected]",
109+
"firstname": "Example", "lastname": "User",
129110
"country": "US",
130111
"option": "ignoreIfAlreadyExists"}}],
131-
"user": "[email protected]"}
112+
"user": "[email protected]"}
132113

133114

134-
def test_create_user_federated_id_unicode():
135-
user = UserAction(id_type=IdentityTypes.federatedID, email=u"[email protected]")
136-
user.create(first_name="Lech", last_name=u"Wałęsa", country="PL")
137-
assert user.wire_dict() == {"do": [{"createFederatedID": {"email": u"[email protected]",
138-
"firstname": "Lech", "lastname": u"Wałęsa",
115+
def test_create_user_federatedid_unicode():
116+
"""
117+
Test federated ID action with email address and no username and unicode in at least one attribute
118+
"""
119+
user = UserAction(id_type=IdentityTypes.federatedID, email=u"[email protected]")
120+
user.create(first_name=u"Exampłę", last_name="User", country="PL")
121+
assert user.wire_dict() == {"do": [{"createFederatedID": {"email": u"[email protected]",
122+
"firstname": u"Exampłę", "lastname": "User",
139123
"country": "PL",
140124
"option": "ignoreIfAlreadyExists"}}],
141-
"user": u"[email protected]"}
125+
"user": u"[email protected]"}
142126

143127

144128
def test_create_user_federatedid_username():
145-
user = UserAction(id_type=IdentityTypes.federatedID, username="dbrotsky", domain="k.on-the-side.net")
146-
user.create(first_name="Daniel", last_name="Brotsky", country="US", email="[email protected]")
147-
assert user.wire_dict() == {"do": [{"createFederatedID": {"email": "[email protected]",
148-
"firstname": "Daniel", "lastname": "Brotsky",
129+
"""
130+
Test federated ID with a username (non-email format)
131+
"""
132+
user = UserAction(id_type=IdentityTypes.federatedID, username="user", domain="example.com")
133+
user.create(first_name="Example", last_name="User", country="US", email="[email protected]")
134+
assert user.wire_dict() == {"do": [{"createFederatedID": {"email": "[email protected]",
135+
"firstname": "Example", "lastname": "User",
149136
"country": "US",
150137
"option": "ignoreIfAlreadyExists"}}],
151-
"user": "dbrotsky", "domain": "k.on-the-side.net"}
138+
"user": "user", "domain": "example.com"}
152139

153140

154141
def test_create_user_federatedid_username_unicode():
155-
user = UserAction(id_type=IdentityTypes.federatedID, username=u"lwalesa", domain="k.on-the-side.net")
156-
user.create(first_name="Lech", last_name=u"Wałęsa", country="PL", email=u"[email protected]")
157-
assert user.wire_dict() == {"do": [{"createFederatedID": {"email": u"[email protected]",
158-
"firstname": "Lech", "lastname": u"Wałęsa",
142+
"""
143+
Test federated ID with a username and unicode attributes (non-email format)
144+
"""
145+
user = UserAction(id_type=IdentityTypes.federatedID, username=u"user", domain="example.com")
146+
user.create(first_name=u"Exampłę", last_name="User", country="PL", email=u"[email protected]")
147+
assert user.wire_dict() == {"do": [{"createFederatedID": {"email": u"[email protected]",
148+
"firstname": u"Exampłę", "lastname": "User",
159149
"country": "PL",
160150
"option": "ignoreIfAlreadyExists"}}],
161-
"user": u"lwalesa", "domain": "k.on-the-side.net"}
151+
"user": u"user", "domain": "example.com"}
162152

163153

164154
def test_create_user_federatedid_username_email():
@@ -172,11 +162,40 @@ def test_create_user_federatedid_username_email():
172162
"user": "dbrotsky", "domain": "k.on-the-side.net"}
173163

174164

175-
def test_create_user_federatedid_username_mismatch():
165+
def test_create_user_federatedid_email_format_username():
166+
"""
167+
Create federated ID with username in email format (with email address)
168+
:return:
169+
"""
176170
user = UserAction(id_type=IdentityTypes.federatedID, username="dbrotsky", domain="k.on-the-side.net",
177-
171+
172+
user.create(first_name="Daniel", last_name="Brotsky", country="US")
173+
assert user.wire_dict() == {"do": [{"createFederatedID": {"email": "[email protected]",
174+
"firstname": "Daniel", "lastname": "Brotsky",
175+
"country": "US",
176+
"option": "ignoreIfAlreadyExists"}}],
177+
"user": "dbrotsky", "domain": "k.on-the-side.net"}
178+
179+
180+
def test_create_user_federatedid_username_mismatch():
181+
"""
182+
Mismatched email in UserAction constructor vs create()
183+
"""
184+
user = UserAction(id_type=IdentityTypes.federatedID, username="user", domain="example.com",
185+
178186
with pytest.raises(ValueError):
179-
user.create(first_name="Daniel", last_name="Brotsky", country="US", email="[email protected]")
187+
user.create(first_name="Example", last_name="User", country="US", email="[email protected]")
188+
189+
190+
def test_different_email_username():
191+
"""
192+
Update a user record so the email address is different than email-type username (federated only)
193+
"""
194+
user = UserAction(id_type=IdentityTypes.federatedID, email="[email protected]")
195+
user.update(email="[email protected]", username="[email protected]")
196+
assert user.wire_dict() == {"do": [{"update": {"email": "[email protected]",
197+
"username": "[email protected]"}}],
198+
"user": "[email protected]"}
180199

181200

182201
def test_update_user_adobeid():

tests/test_legacy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2016-2017 Adobe Systems Incorporated. All rights reserved.
1+
# Copyright (c) 2016-2017 Adobe Inc. All rights reserved.
22
#
33
# Permission is hereby granted, free of charge, to any person obtaining a copy
44
# of this software and associated documentation files (the "Software"), to deal

tests/test_live.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2016-2017 Adobe Systems Incorporated. All rights reserved.
1+
# Copyright (c) 2016-2017 Adobe Inc. All rights reserved.
22
#
33
# Permission is hereby granted, free of charge, to any person obtaining a copy
44
# of this software and associated documentation files (the "Software"), to deal
@@ -166,4 +166,4 @@ def test_remove_user_group(config):
166166
result = usergroups.create(groupName)
167167
groupID = result.groupid
168168
usergroups.delete(groupID)
169-
assert usergroups.getGroupIDByName(groupName) == None
169+
assert usergroups.getGroupIDByName(groupName) == None

0 commit comments

Comments
 (0)