Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ludovic Kiefer
erp5
Commits
9c7d18be
Commit
9c7d18be
authored
Jul 01, 2019
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oauth_facebook_login: test the case of existing user
parent
fd308ae7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
bt5/erp5_oauth_facebook_login/TestTemplateItem/portal_components/test.erp5.testFacebookLogin.py
...lateItem/portal_components/test.erp5.testFacebookLogin.py
+43
-0
No files found.
bt5/erp5_oauth_facebook_login/TestTemplateItem/portal_components/test.erp5.testFacebookLogin.py
View file @
9c7d18be
...
...
@@ -98,6 +98,49 @@ class TestFacebookLogin(ERP5TypeTestCase):
self
.
assertNotIn
(
"secret_key="
,
location
)
self
.
assertIn
(
"ERP5Site_callbackFacebookLogin"
,
location
)
def
test_existing_user
(
self
):
self
.
login
()
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
)
person
.
newContent
(
portal_type
=
'Facebook Login'
,
reference
=
getUserId
(
None
)
).
validate
()
person
.
newContent
(
portal_type
=
'Assignment'
).
open
()
self
.
tic
()
self
.
logout
()
request
=
self
.
portal
.
REQUEST
response
=
request
.
RESPONSE
with
mock
.
patch
(
'erp5.component.extension.FacebookLoginUtility.getAccessTokenFromCode'
,
side_effect
=
getAccessTokenFromCode
,
)
as
getAccessTokenFromCode_mock
,
\
mock
.
patch
(
'erp5.component.extension.FacebookLoginUtility.getUserEntry'
,
side_effect
=
getUserEntry
)
as
getUserEntry_mock
:
getAccessTokenFromCode_mock
.
func_code
=
getAccessTokenFromCode
.
func_code
getUserEntry_mock
.
func_code
=
getUserEntry
.
func_code
self
.
portal
.
ERP5Site_callbackFacebookLogin
(
code
=
CODE
)
getAccessTokenFromCode_mock
.
assert_called_once
()
getUserEntry_mock
.
assert_called_once
()
request
[
"__ac_facebook_hash"
]
=
response
.
cookies
[
"__ac_facebook_hash"
][
"value"
]
credentials
=
self
.
portal
.
acl_users
.
erp5_facebook_extraction
.
extractCredentials
(
request
)
self
.
assertEqual
(
'Facebook Login'
,
credentials
[
'login_portal_type'
])
self
.
assertEqual
(
getUserId
(
None
),
credentials
[
'external_login'
])
user_id
,
login
=
self
.
portal
.
acl_users
.
erp5_login_users
.
authenticateCredentials
(
credentials
)
self
.
assertEqual
(
person
.
getUserId
(),
user_id
)
self
.
assertEqual
(
getUserId
(
None
),
login
)
def
test_auth_cookie
(
self
):
request
=
self
.
portal
.
REQUEST
response
=
request
.
RESPONSE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment