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
137
Merge Requests
137
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
Jobs
Commits
Open sidebar
nexedi
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
Pipeline
#35730
failed with stage
in 0 seconds
Changes
1
Pipelines
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