Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
900c1ace
Commit
900c1ace
authored
Mar 02, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
Early changes zope4py2
See merge request
nexedi/slapos.core!495
parents
4e99e918
4b7cd3ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
40 deletions
+106
-40
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
...omponents/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
+9
-4
master/bt5/slapos_jio_ui_test/SkinTemplateItem/portal_skins/slapos_ui_test/ERP5Site_getDemoFunctionalUserResetPasswordLinkSentByMail.py
...5Site_getDemoFunctionalUserResetPasswordLinkSentByMail.py
+1
-0
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
...m/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
+82
-32
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
...ortal_components/test.erp5.testSlapOSSubscriptionSkins.py
+14
-4
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
View file @
900c1ace
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
#
#
##############################################################################
##############################################################################
import
six
import
six.moves.urllib.parse
from
erp5.component.test.testSlapOSCloudSecurityGroup
import
TestSlapOSSecurityMixin
from
erp5.component.test.testSlapOSCloudSecurityGroup
import
TestSlapOSSecurityMixin
from
erp5.component.test.SlapOSTestCaseMixin
import
changeSkin
from
erp5.component.test.SlapOSTestCaseMixin
import
changeSkin
import
re
import
re
...
@@ -65,7 +67,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
...
@@ -65,7 +67,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
email
=
'%s@example.com'
%
reference
email
=
'%s@example.com'
%
reference
re
quest
=
self
.
web_site
.
hateoas
.
connection
.
WebSection_newCredentialRequest
(
re
direct_url
=
self
.
web_site
.
hateoas
.
connection
.
WebSection_newCredentialRequest
(
reference
=
reference
,
reference
=
reference
,
default_email_text
=
email
,
default_email_text
=
email
,
first_name
=
"Joe"
,
first_name
=
"Joe"
,
...
@@ -77,9 +79,12 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
...
@@ -77,9 +79,12 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
default_address_street_address
=
"Av Pelinca"
,
default_address_street_address
=
"Av Pelinca"
,
default_address_zip_code
=
"28480"
,
default_address_zip_code
=
"28480"
,
)
)
parsed_url
=
six
.
moves
.
urllib
.
parse
.
urlparse
(
redirect_url
)
self
.
assertIn
(
'Thank you for your registration. You will receive an email to activate your account.'
,
request
)
self
.
assertEqual
(
parsed_url
.
path
.
split
(
'/'
)[
-
1
],
'login_form'
)
self
.
assertEqual
(
sorted
(
six
.
iteritems
(
dict
(
six
.
moves
.
urllib
.
parse
.
parse_qsl
(
parsed_url
.
query
)))),
[
(
'portal_status_message'
,
'Thank you for your registration. You will receive an email to activate your account.'
),
])
self
.
tic
()
self
.
tic
()
to_click_message
=
findMessage
(
email
,
'You have requested one user'
)
to_click_message
=
findMessage
(
email
,
'You have requested one user'
)
...
...
master/bt5/slapos_jio_ui_test/SkinTemplateItem/portal_skins/slapos_ui_test/ERP5Site_getDemoFunctionalUserResetPasswordLinkSentByMail.py
View file @
900c1ace
...
@@ -7,4 +7,5 @@ assert "WebSite_viewResetPassword" in last_message[2]
...
@@ -7,4 +7,5 @@ assert "WebSite_viewResetPassword" in last_message[2]
message
=
last_message
[
2
].
replace
(
"
\
n
"
,
" "
)
message
=
last_message
[
2
].
replace
(
"
\
n
"
,
" "
)
for
_word
in
message
.
split
(
" "
):
for
_word
in
message
.
split
(
" "
):
if
"WebSite_viewResetPassword?reset_key"
in
_word
:
if
"WebSite_viewResetPassword?reset_key"
in
_word
:
container
.
REQUEST
.
REPONSE
.
setHeader
(
'Content-Type'
,
'text/html'
)
return
"<a href='%s' name='reset_password'>Reset Password link sent by mail </a>"
%
_word
.
strip
()
return
"<a href='%s' name='reset_password'>Reset Password link sent by mail </a>"
%
_word
.
strip
()
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
View file @
900c1ace
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
import
lxml.html
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
import
difflib
HARDCODED_PRICE
=
-
99.6
HARDCODED_PRICE
=
-
99.6
...
@@ -195,44 +195,94 @@ class TestSlapOSPayzenInterfaceWorkflow(SlapOSTestCaseMixinWithAbort):
...
@@ -195,44 +195,94 @@ class TestSlapOSPayzenInterfaceWorkflow(SlapOSTestCaseMixinWithAbort):
self
.
portal
.
portal_secure_payments
.
slapos_payzen_test
.
_getFieldList
(
data_dict
)
self
.
portal
.
portal_secure_payments
.
slapos_payzen_test
.
_getFieldList
(
data_dict
)
data_dict
[
'action'
]
=
'https://secure.payzen.eu/vads-payment/'
data_dict
[
'action'
]
=
'https://secure.payzen.eu/vads-payment/'
expected_html_page
=
lxml
.
html
.
tostring
(
lxml
.
html
.
fromstring
(
'''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>title</title>
</head>
<body onload="document.payment.submit();">
<form action="%(action)s" id="payment" method="POST" name="payment">
expected_html_page
=
\
<input name="signature" type="hidden" value="%(signature)s"></input>
'<form method="POST'
\
'" id="payment" name="payment"
\
n
action="%(action)s">
\
n
\
n
<input '
\
'type="hidden" name="vads_url_return"
\
n
value="'
\
<input name="vads_action_mode" type="hidden" value="INTERACTIVE"></input>
'%(vads_url_return)s">
\
n
\
n
\
n
<input type="hidden" name="vads_site_id" '
\
'value="%(vads_site_id)s">
\
n
\
n
\
n
<input type="hidden" name="vads_url_e'
\
'rror"
\
n
value="%(vads_url_error)s">
\
n
\
n
\
n
<input type="hidden'
\
<input name="vads_amount" type="hidden" value="%(vads_amount)s"></input>
'" name="vads_trans_id" value="%(vads_trans_id)s">
\
n
\
n
\
n
'
\
'<input type="hidden" name="vads_url_success"
\
n
value="'
\
'%(vads_url_success)s">
\
n
\
n
\
n
<input type="hidden" name="vads_order_id'
\
<input name="vads_contrib" type="hidden" value="ERP5"></input>
'"
\
n
value="%(vads_order_id)s">
\
n
\
n
\
n
<input type="hidden" name="vads_url_refe'
\
'rral"
\
n
value="%(vads_url_referral)s">
\
n
\
n
\
n
<input type="hid'
\
'den" name="vads_page_action"
\
n
value="PAYMENT">
\
n
\
n
\
n
<input '
\
<input name="vads_ctx_mode" type="hidden" value="TEST"></input>
'type="hidden" name="vads_trans_date"
\
n
value="'
\
'%(vads_trans_date)s">
\
n
\
n
\
n
<input type="hidden" name="vads_url_refus'
\
'ed"
\
n
value="%(vads_url_refused)s">
\
n
\
n
\
n
<input type="hidden'
\
<input name="vads_currency" type="hidden" value="%(vads_currency)s"></input>
'" name="vads_url_cancel"
\
n
value="%(vads_url_cancel)s">
\
n
\
n
\
n
'
\
' <input type="hidden" name="vads_ctx_mode" value="TEST">
\
n
\
n
\
n
<input '
\
'type="hidden" name="vads_payment_config"
\
n
value="SINGLE">
\
n
\
n
'
\
<input name="vads_language" type="hidden" value="%(vads_language)s"></input>
'
\
n
<input type="hidden" name="vads_contrib" value="ERP5">
\
n
\
n
\
n
<inp'
\
'ut type="hidden" name="signature"
\
n
value="%(signature)s">
\
n
\
n
'
\
'
\
n
<input type="hidden" name="vads_language" value="%(vads_language)s">
\
n
\
n
\
n
<inpu'
\
<input name="vads_order_id" type="hidden" value="%(vads_order_id)s"></input>
't type="hidden" name="vads_currency" value="%(vads_currency)s">
\
n
\
n
\
n
'
\
' <input type="hidden" name="vads_amount" value="%(vads_amount)s">
\
n
\
n
\
n
'
\
' <input type="hidden" name="vads_version" value="V2">
\
n
\
n
\
n
<input type="'
\
<input name="vads_page_action" type="hidden" value="PAYMENT"></input>
'hidden" name="vads_action_mode"
\
n
value="INTERACTIVE">
\
n
\
n
<center>
\
n
'
\
' <input type="submit" value="Click to pay">
\
n
</center>
\
n
</form>'
%
data_dict
<input name="vads_payment_config" type="hidden" value="SINGLE"></input>
<input name="vads_site_id" type="hidden" value="%(vads_site_id)s"></input>
<input name="vads_trans_date" type="hidden" value="%(vads_trans_date)s"></input>
<input name="vads_trans_id" type="hidden" value="%(vads_trans_id)s"></input>
<input name="vads_url_cancel" type="hidden" value="%(vads_url_cancel)s"></input>
<input name="vads_url_error" type="hidden" value="%(vads_url_error)s"></input>
<input name="vads_url_referral" type="hidden" value="%(vads_url_referral)s"></input>
<input name="vads_url_refused" type="hidden" value="%(vads_url_refused)s"></input>
<input name="vads_url_return" type="hidden" value="%(vads_url_return)s"></input>
<input name="vads_url_success" type="hidden" value="%(vads_url_success)s"></input>
<input name="vads_version" type="hidden" value="V2"></input>
<center>
<input type="submit" value="Click to pay"></input>
</center>
</form>
</body>
</html>'''
%
data_dict
),
method
=
'c14n'
)
# Event message state
# Event message state
event_message_list
=
event
.
contentValues
(
portal_type
=
"Payzen Event Message"
)
event_message_list
=
event
.
contentValues
(
portal_type
=
"Payzen Event Message"
)
self
.
assertEqual
(
len
(
event_message_list
),
1
)
self
.
assertEqual
(
len
(
event_message_list
),
1
)
message
=
event_message_list
[
0
]
message
=
event_message_list
[
0
]
self
.
assertEqual
(
message
.
getTitle
(),
'Shown Page'
)
self
.
assertEqual
(
message
.
getTitle
(),
'Shown Page'
)
self
.
assertIn
(
expected_html_page
,
message
.
getTextContent
(),
'
\
n
'
.
join
([
q
for
q
in
difflib
.
unified_diff
(
expected_html_page
.
split
(
'
\
n
'
),
message_text_content
=
lxml
.
html
.
tostring
(
message
.
getTextContent
().
split
(
'
\
n
'
))])
)
lxml
.
html
.
fromstring
(
message
.
getTextContent
()),
method
=
'c14n'
)
self
.
assert
In
(
'onload="document.payment.submit();"'
,
message
.
getTextContent
()
)
self
.
assert
Equal
(
message_text_content
,
expected_html_page
)
def
test_updateStatus_noAccountingTransaction
(
self
):
def
test_updateStatus_noAccountingTransaction
(
self
):
event
=
self
.
createPayzenEvent
()
event
=
self
.
createPayzenEvent
()
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
View file @
900c1ace
...
@@ -18,6 +18,10 @@
...
@@ -18,6 +18,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
##############################################################################
##############################################################################
import
six
import
six.moves.urllib.parse
from
erp5.component.test.SlapOSTestCaseMixin
import
\
from
erp5.component.test.SlapOSTestCaseMixin
import
\
SlapOSTestCaseMixinWithAbort
,
simulate
SlapOSTestCaseMixinWithAbort
,
simulate
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
...
@@ -310,13 +314,19 @@ class Test0SubscriptionRequestModule_requestSubscriptionProxy(TestSubscriptionSk
...
@@ -310,13 +314,19 @@ class Test0SubscriptionRequestModule_requestSubscriptionProxy(TestSubscriptionSk
self
.
tic
()
self
.
tic
()
module
=
self
.
portal
.
web_site_module
.
hostingjs
.
subscription_request_module
module
=
self
.
portal
.
web_site_module
.
hostingjs
.
subscription_request_module
re
sponse
=
module
.
SubscriptionRequestModule_requestSubscriptionProxy
(
re
direct_url
=
module
.
SubscriptionRequestModule_requestSubscriptionProxy
(
email
=
email
,
subscription_reference
=
subscription_reference
,
email
=
email
,
subscription_reference
=
subscription_reference
,
confirmation_required
=
True
,
user_input_dict
=
user_input_dict
)
confirmation_required
=
True
,
user_input_dict
=
user_input_dict
)
self
.
assertTrue
(
parsed_url
=
six
.
moves
.
urllib
.
parse
.
urlparse
(
redirect_url
)
response
.
endswith
(
self
.
assertEqual
(
parsed_url
.
path
.
split
(
'/'
)[
-
1
],
'order_confirmation'
)
"order_confirmation?field_your_reservation_name=Member Template&field_your_reservation_email=%s&field_your_reservation_number_of_machines=1&field_your_reservation_network=test_subscription_reference"
%
email
),
response
)
self
.
assertEqual
(
sorted
(
six
.
iteritems
(
dict
(
six
.
moves
.
urllib
.
parse
.
parse_qsl
(
parsed_url
.
query
)))),
[
(
'field_your_reservation_email'
,
email
),
(
'field_your_reservation_name'
,
'Member Template'
),
(
'field_your_reservation_network'
,
'test_subscription_reference'
),
(
'field_your_reservation_number_of_machines'
,
'1'
),
])
# Missing tests XXXX
# Missing tests XXXX
class
TestSubscriptionRequest_applyCondition
(
TestSubscriptionSkinsMixin
):
class
TestSubscriptionRequest_applyCondition
(
TestSubscriptionSkinsMixin
):
...
...
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