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
18
Merge Requests
18
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
nexedi
slapos.core
Commits
4f56b762
Commit
4f56b762
authored
Jan 28, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
Redirect url and tests
See merge request
nexedi/slapos.core!277
parents
cd6c250c
4962d490
Pipeline
#13357
passed with stage
in 0 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
7 deletions
+46
-7
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSXHTML.py
...mplateItem/portal_components/test.erp5.testSlapOSXHTML.py
+2
-1
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequestModule_requestSubscriptionProxy.py
...est/SubscriptionRequestModule_requestSubscriptionProxy.py
+3
-3
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
...ortal_components/test.erp5.testSlapOSSubscriptionSkins.py
+3
-2
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/PaymentTransaction_redirectToManualWechatPayment.py
...echat/PaymentTransaction_redirectToManualWechatPayment.py
+2
-1
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatSkins.py
...Item/portal_components/test.erp5.testSlapOSWechatSkins.py
+31
-0
master/bt5/slapos_wechat/WorkflowTemplateItem/portal_workflow/wechat_interface_workflow/scripts/WechatEvent_generateNavigationPage.py
...ce_workflow/scripts/WechatEvent_generateNavigationPage.py
+5
-0
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSXHTML.py
View file @
4f56b762
...
...
@@ -38,7 +38,8 @@ class TestSlapOSXHTML(SlapOSTestCaseMixin, testXHTML.TestXHTML):
'erp5_run_my_doc'
,
'erp5_web_renderjs'
,
'erp5_corporate_identity'
,
'erp5_corporate_identity_web'
,
'erp5_notebook'
,
'erp5_officejs_notebook'
)
'erp5_notebook'
,
'erp5_officejs_notebook'
,
'erp5_web_js_style_ui'
)
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
# Live tests all uses the same request. For now we remove cell from
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequestModule_requestSubscriptionProxy.py
View file @
4f56b762
...
...
@@ -17,7 +17,7 @@ if token:
if
error
:
base_url
=
web_site
.
absolute_url
()
redirect_url
=
"%s/
#order?name=%s&email=%s&amount=%s&subscription_reference=%s&token=%s&error
=%s"
%
(
redirect_url
=
"%s/
order?field_your_reservation_name=%s&field_your_reservation_email=%s&field_your_reservation_number_of_machines=%s&field_your_reservation_network=%s&field_your_reservation_invitation_token=%s&portal_status_message
=%s"
%
(
base_url
,
user_input_dict
[
'name'
],
email
,
...
...
@@ -34,14 +34,14 @@ person, person_is_new = context.SubscriptionRequest_createUser(email, user_input
# Check if user is already exist, otherwise redirect to ask confirmation
if
confirmation_required
and
not
person_is_new
:
base_url
=
web_site
.
absolute_url
()
redirect_url
=
"%s/
#order_confirmation?name=%s&email=%s&amount=%s&subscription_reference
=%s"
%
(
redirect_url
=
"%s/
order_confirmation?field_your_reservation_name=%s&field_your_reservation_email=%s&field_your_reservation_number_of_machines=%s&field_your_reservation_network
=%s"
%
(
base_url
,
person
.
getTitle
(),
person
.
getDefaultEmailText
(),
user_input_dict
[
"amount"
],
subscription_reference
)
if
token
:
redirect_url
+=
"&token=%s"
%
token
redirect_url
+=
"&
field_your_reservation_invitation_
token=%s"
%
token
return
context
.
REQUEST
.
RESPONSE
.
redirect
(
redirect_url
)
if
target_language
is
None
:
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
View file @
4f56b762
...
...
@@ -353,8 +353,9 @@ class Test0SubscriptionRequestModule_requestSubscriptionProxy(TestSubscriptionSk
email
=
email
,
subscription_reference
=
subscription_reference
,
confirmation_required
=
True
,
user_input_dict
=
user_input_dict
)
self
.
assertTrue
(
response
.
endswith
(
"#order_confirmation?name=Member Template&email=%s&amount=1&subscription_reference=test_subscription_reference"
%
email
),
response
)
self
.
assertTrue
(
response
.
endswith
(
"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
)
# Missing tests XXXX
class
TestSubscriptionRequest_applyCondition
(
TestSubscriptionSkinsMixin
):
...
...
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/PaymentTransaction_redirectToManualWechatPayment.py
View file @
4f56b762
...
...
@@ -18,7 +18,8 @@ def wrapWithShadow(payment_transaction, web_site, person_relative_url):
title
=
'User navigation script for %s'
%
payment_transaction
.
getTitle
(),
destination_section
=
person_relative_url
,
)
if
web_site
:
context
.
REQUEST
.
set
(
'base_url'
,
'%s/wechat_payment'
%
web_site
.
absolute_url
())
system_event
.
generateManualPaymentPage
()
return
system_event
.
contentValues
(
...
...
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatSkins.py
View file @
4f56b762
...
...
@@ -691,6 +691,37 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
"%s do not start with %s"
%
(
redirected_url
,
expected
))
transaction
.
abort
()
def
test_PaymentTransaction_redirectToManualWechatPayment_redirect_with_website
(
self
):
person
=
self
.
makePerson
()
invoice
=
self
.
createWechatSaleInvoiceTransaction
(
destination_section
=
person
.
getRelativeUrl
())
self
.
tic
()
payment
=
invoice
.
SaleInvoiceTransaction_getWechatPaymentRelatedValue
()
payment
.
setResourceValue
(
self
.
portal
.
currency_module
.
EUR
)
payment_transaction_id
=
payment
.
getId
()
web_site
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
)
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
_simulatePaymentTransaction_getVADSUrlDict
()
try
:
def
callFakeWechatApi
(
self
,
URL
,
wechat_dict
):
return
{
"result_code"
:
'SUCCESS'
,
"code_url"
:
'weixin://wxpay/bizpayurl?pr=AAAAA'
}
original_callWechatApi
=
WechatService
.
callWechatApi
WechatService
.
callWechatApi
=
callFakeWechatApi
try
:
redirected_url
=
payment
.
PaymentTransaction_redirectToManualWechatPayment
(
web_site
)
finally
:
WechatService
.
callWechatApi
=
original_callWechatApi
finally
:
self
.
_dropPaymentTransaction_getVADSUrlDict
()
self
.
assertEqual
(
payment
.
PaymentTransaction_getTotalPayablePrice
(),
0
)
expected
=
"%s/wechat_payment?trade_no=%s&price=0&payment_url=weixin://wxpay/bizpayurl?pr="
%
(
web_site
.
absolute_url
(),
payment_transaction_id
)
self
.
assertTrue
(
redirected_url
.
startswith
(
expected
),
"%s do not start with %s"
%
(
redirected_url
,
expected
))
transaction
.
abort
()
def
test_PaymentTransaction_redirectToManualWechatPayment_already_registered
(
self
):
person
=
self
.
makePerson
()
...
...
master/bt5/slapos_wechat/WorkflowTemplateItem/portal_workflow/wechat_interface_workflow/scripts/WechatEvent_generateNavigationPage.py
View file @
4f56b762
...
...
@@ -16,6 +16,11 @@ wechat_dict = {
'body'
:
"Rapid Space Virtual Machine"
.
encode
(
'utf-8'
)
}
base_url
=
context
.
REQUEST
.
get
(
'base_url'
,
''
)
if
base_url
:
wechat_dict
[
'base_url'
]
=
base_url
html_document
=
context
.
WechatEvent_callWechatServiceNavigation
(
state_change
,
wechat_dict
)
wechat_event
.
newContent
(
title
=
'Shown Page'
,
...
...
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