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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
e914a5ce
Commit
e914a5ce
authored
Jul 02, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_oauth_google_login: Extend test for consider configured or not connectors
On login pages
parent
9dd76a3b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
bt5/erp5_oauth_google_login/TestTemplateItem/portal_components/test.erp5.testGoogleLogin.py
...mplateItem/portal_components/test.erp5.testGoogleLogin.py
+20
-1
No files found.
bt5/erp5_oauth_google_login/TestTemplateItem/portal_components/test.erp5.testGoogleLogin.py
View file @
e914a5ce
...
...
@@ -60,13 +60,16 @@ class GoogleLoginTestCase(ERP5TypeTestCase):
).
validate
()
self
.
default_user_person
.
newContent
(
portal_type
=
'Assignment'
).
open
()
if
getattr
(
self
.
portal
.
portal_oauth
,
self
.
dummy_connector_id
,
None
)
is
None
:
connector
=
getattr
(
self
.
portal
.
portal_oauth
,
self
.
dummy_connector_id
,
None
)
if
connector
is
None
:
connector
=
self
.
portal
.
portal_oauth
.
newContent
(
id
=
self
.
dummy_connector_id
,
portal_type
=
"Google Connector"
,
reference
=
"default"
,
client_id
=
self
.
client_id
,
secret_key
=
self
.
secret_key
)
if
connector
.
getValidationState
()
!=
"validated"
:
connector
.
validate
()
self
.
tic
()
...
...
@@ -416,6 +419,22 @@ class TestERP5JSGoogleLogin(GoogleLoginTestCase):
self
.
assertEqual
(
resp
.
getStatus
(),
six
.
moves
.
http_client
.
FOUND
)
self
.
assertIn
(
'google.com'
,
resp
.
getHeader
(
'Location'
))
def
test_login_form_not_configured
(
self
):
connector
=
getattr
(
self
.
portal
.
portal_oauth
,
self
.
dummy_connector_id
,
None
)
if
connector
is
not
None
:
if
connector
.
getValidationState
()
==
"validated"
:
connector
.
invalidate
()
self
.
tic
()
resp
=
self
.
publish
(
self
.
_getWebSite
().
getPath
()
+
'/login_form'
)
tree
=
lxml
.
etree
.
fromstring
(
resp
.
getBody
(),
parser
=
lxml
.
etree
.
HTMLParser
())
self
.
assertEqual
([],
[
img
.
getparent
().
attrib
[
'href'
]
for
img
in
tree
.
findall
(
'.//a/img'
)
if
img
.
attrib
[
'alt'
]
==
'Sign in with Google'
])
def
test_logout
(
self
):
resp
=
self
.
publish
(
self
.
_getWebSite
().
getPath
()
+
'/WebSite_logout'
)
self
.
assertEqual
(
resp
.
getCookie
(
"__ac_google_hash"
)[
'value'
],
'deleted'
)
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