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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
3947e7d9
Commit
3947e7d9
authored
Feb 14, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: test: fixup
parent
b3ccd823
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
104 deletions
+5
-104
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
.../portal_components/test.erp5.testSlapOSAccountingSkins.py
+5
-104
No files found.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
View file @
3947e7d9
...
...
@@ -133,26 +133,6 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
self
.
portal
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_bad_payment_mode
(
self
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
()
invoice
.
edit
(
payment_mode
=
"cash"
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_bad_state
(
self
,
payment_mode
=
'payzen'
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
payment_mode
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice
,
'delivered'
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_zero_price
(
self
,
payment_mode
=
'payzen'
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
payment_mode
)
...
...
@@ -163,26 +143,6 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wrong_trade_condition
(
self
,
payment_mode
=
'payzen'
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
payment_mode
)
invoice
.
edit
(
specialise
=
None
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wrong_ledger
(
self
,
payment_mode
=
'payzen'
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
payment_mode
)
invoice
.
edit
(
ledger
=
None
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_paid
(
self
,
payment_mode
=
'payzen'
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
payment_mode
)
...
...
@@ -220,7 +180,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
reversale_invoice
=
invoice
.
\
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
(
batch_mode
=
1
)
self
.
assertEqual
(
invoice
.
getPaymentMode
(
""
),
""
)
self
.
assertEqual
(
invoice
.
getPaymentMode
(
""
),
payment_mode
)
self
.
assertEqual
(
reversale_invoice
.
getTitle
(),
"Reversal Transaction for %s"
%
invoice
.
getTitle
())
self
.
assertEqual
(
reversale_invoice
.
getDescription
(),
...
...
@@ -280,74 +240,15 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
self
.
tic
()
reversale_invoice
=
invoice
.
\
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
(
batch_mode
=
1
)
self
.
assertEqual
(
invoice
.
getPaymentMode
(
""
),
""
)
# Related payment is cancelled by a proper alarm.
self
.
assertEqual
(
payment
.
getSimulationState
(),
"started"
)
self
.
assertEqual
(
reversale_invoice
.
getTitle
(),
"Reversal Transaction for %s"
%
invoice
.
getTitle
())
self
.
assertEqual
(
reversale_invoice
.
getDescription
(),
"Reversal Transaction for %s"
%
invoice
.
getTitle
())
self
.
assertEqual
(
reversale_invoice
.
getCausality
(),
invoice
.
getRelativeUrl
())
self
.
assertEqual
(
reversale_invoice
.
getSimulationState
(),
"stopped"
)
self
.
assertEqual
(
invoice
.
getSimulationState
(),
"stopped"
)
invoice_line_id
=
invoice
.
contentValues
(
portal_type
=
"Invoice Line"
)[
0
].
getId
()
transaction_line_id
=
invoice
.
contentValues
(
portal_type
=
"Sale Invoice Transaction Line"
)[
0
].
getId
()
self
.
assertEqual
(
invoice
[
invoice_line_id
].
getQuantity
(),
-
reversale_invoice
[
invoice_line_id
].
getQuantity
())
self
.
assertEqual
(
reversale_invoice
[
invoice_line_id
].
getQuantity
(),
2
)
self
.
assertEqual
(
invoice
[
transaction_line_id
].
getQuantity
(),
-
reversale_invoice
[
transaction_line_id
].
getQuantity
())
self
.
assertEqual
(
reversale_invoice
[
transaction_line_id
].
getQuantity
(),
3
)
self
.
assertEqual
(
len
(
invoice
.
getMovementList
()),
2
)
# Both invoice should have a grouping reference
self
.
assertNotEqual
(
invoice
[
transaction_line_id
].
getGroupingReference
(
""
),
""
)
self
.
assertEqual
(
invoice
[
transaction_line_id
].
getGroupingReference
(
"1"
),
reversale_invoice
[
transaction_line_id
].
getGroupingReference
(
"2"
))
# All references should be regenerated
self
.
assertNotEqual
(
invoice
.
getReference
(
""
),
reversale_invoice
.
getReference
(
""
))
self
.
assertNotEqual
(
invoice
.
getSourceReference
(
""
),
reversale_invoice
.
getSourceReference
(
""
))
self
.
assertNotEqual
(
invoice
.
getDestinationReference
(
""
),
reversale_invoice
.
getDestinationReference
(
""
))
self
.
assertTrue
(
invoice
.
SaleInvoiceTransaction_isLettered
())
self
.
assertTrue
(
reversale_invoice
.
SaleInvoiceTransaction_isLettered
())
# Another trade condition
self
.
assertEqual
(
reversale_invoice
.
getSpecialise
(),
"sale_trade_condition_module/slapos_manual_accounting_trade_condition"
)
self
.
tic
()
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wechat_bad_state
(
self
):
self
.
test_createReversalSaleInvoiceTransaction_bad_state
(
payment_mode
=
'wechat'
)
self
.
assertRaises
(
ValueError
,
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wechat_zero_price
(
self
):
self
.
test_createReversalSaleInvoiceTransaction_zero_price
(
payment_mode
=
'wechat'
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wechat_wrong_trade_condition
(
self
):
self
.
test_createReversalSaleInvoiceTransaction_wrong_trade_condition
(
payment_mode
=
'wechat'
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wechat_wrong_ledger
(
self
):
self
.
test_createReversalSaleInvoiceTransaction_wrong_ledger
(
payment_mode
=
'wechat'
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wechat_paid
(
self
):
self
.
test_createReversalSaleInvoiceTransaction_paid
(
payment_mode
=
'wechat'
)
...
...
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