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
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
Xiaowu Zhang
slapos.core
Commits
14d9ba81
Commit
14d9ba81
authored
Jan 22, 2021
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_wechat: add one more wechat pament redirect test
parent
0503bb07
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatSkins.py
...Item/portal_components/test.erp5.testSlapOSWechatSkins.py
+31
-0
No files found.
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatSkins.py
View file @
14d9ba81
...
...
@@ -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
()
...
...
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