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
cbb00275
Commit
cbb00275
authored
Jun 22, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oauth_google_login: test integration with ERP5JS
parent
10a8aafd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
3 deletions
+31
-3
bt5/erp5_oauth_google_login/TestTemplateItem/portal_components/test.erp5.testGoogleLogin.py
...mplateItem/portal_components/test.erp5.testGoogleLogin.py
+29
-2
bt5/erp5_oauth_google_login/bt/test_dependency_list
bt5/erp5_oauth_google_login/bt/test_dependency_list
+2
-1
No files found.
bt5/erp5_oauth_google_login/TestTemplateItem/portal_components/test.erp5.testGoogleLogin.py
View file @
cbb00275
...
@@ -27,6 +27,9 @@
...
@@ -27,6 +27,9 @@
import
uuid
import
uuid
import
mock
import
mock
import
lxml
import
urlparse
import
httplib
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
...
@@ -89,8 +92,7 @@ def getUserEntry(access_token):
...
@@ -89,8 +92,7 @@ def getUserEntry(access_token):
}
}
class
TestGoogleLogin
(
ERP5TypeTestCase
):
class
GoogleLoginTestCase
(
ERP5TypeTestCase
):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
"""
"""
This is ran before anything, used to set the environment
This is ran before anything, used to set the environment
...
@@ -123,6 +125,8 @@ class TestGoogleLogin(ERP5TypeTestCase):
...
@@ -123,6 +125,8 @@ class TestGoogleLogin(ERP5TypeTestCase):
self
.
tic
()
self
.
tic
()
self
.
logout
()
self
.
logout
()
class
TestGoogleLogin
(
GoogleLoginTestCase
):
def
test_redirect
(
self
):
def
test_redirect
(
self
):
"""
"""
Check URL generate to redirect to Google
Check URL generate to redirect to Google
...
@@ -304,3 +308,26 @@ return credential_request
...
@@ -304,3 +308,26 @@ return credential_request
def
test_logout
(
self
):
def
test_logout
(
self
):
resp
=
self
.
publish
(
self
.
portal
.
getId
()
+
'/logout'
)
resp
=
self
.
publish
(
self
.
portal
.
getId
()
+
'/logout'
)
self
.
assertEqual
(
resp
.
getCookie
(
"__ac_google_hash"
)[
'value'
],
'deleted'
)
self
.
assertEqual
(
resp
.
getCookie
(
"__ac_google_hash"
)[
'value'
],
'deleted'
)
class
TestERP5JSGoogleLogin
(
GoogleLoginTestCase
):
def
_getWebSite
(
self
):
return
self
.
portal
.
web_site_module
.
renderjs_runner
def
test_login_form
(
self
):
resp
=
self
.
publish
(
self
.
_getWebSite
().
getPath
()
+
'/login_form'
)
tree
=
lxml
.
etree
.
fromstring
(
resp
.
getBody
(),
parser
=
lxml
.
etree
.
HTMLParser
())
google_login_link
,
=
[
img
.
getparent
().
attrib
[
'href'
]
for
img
in
tree
.
findall
(
'.//a/img'
)
if
img
.
attrib
[
'alt'
]
==
'Sign in with Google'
]
self
.
assertIn
(
'/ERP5Site_redirectToGoogleLoginPage'
,
google_login_link
)
resp
=
self
.
publish
(
urlparse
.
urlparse
(
google_login_link
).
path
)
# this request redirects to google
self
.
assertEqual
(
resp
.
getStatus
(),
httplib
.
FOUND
)
self
.
assertIn
(
'google.com'
,
resp
.
getHeader
(
'Location'
))
def
test_logout
(
self
):
resp
=
self
.
publish
(
self
.
_getWebSite
().
getPath
()
+
'/WebSite_logout'
)
self
.
assertEqual
(
resp
.
getCookie
(
"__ac_google_hash"
)[
'value'
],
'deleted'
)
bt5/erp5_oauth_google_login/bt/test_dependency_list
View file @
cbb00275
erp5_full_text_myisam_catalog
erp5_full_text_myisam_catalog
erp5_credential
erp5_credential
erp5_web_renderjs_ui
\ No newline at end of file
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