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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.core
Commits
e0026786
Commit
e0026786
authored
Nov 20, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement invoice constraint tests.
parent
4ed26f94
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
7 deletions
+88
-7
master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingConstraint.py
...unting/TestTemplateItem/testSlapOSAccountingConstraint.py
+87
-6
master/bt5/slapos_accounting/bt/revision
master/bt5/slapos_accounting/bt/revision
+1
-1
No files found.
master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingConstraint.py
View file @
e0026786
...
...
@@ -6,6 +6,7 @@
##############################################################################
from
testSlapOSCloudConstraint
import
TestSlapOSConstraintMixin
from
Products.ERP5Type.Base
import
WorkflowMethod
from
Products.SlapOS.tests.testSlapOSMixin
import
withAbort
import
transaction
...
...
@@ -97,20 +98,100 @@ class TestHostingSubscription(TestSlapOSConstraintMixin):
template
%
'periodicity_month_day'
,
empty_string
=
False
)
class
TestSaleInvoiceTransaction
(
TestSlapOSConstraintMixin
):
@
withAbort
def
_test_currency
(
self
,
invoice
,
setter
,
message
):
self
.
assertTrue
(
message
in
self
.
getMessageList
(
invoice
))
currency
=
self
.
portal
.
currency_module
.
newContent
(
portal_type
=
'Currency'
)
setter
(
currency
.
getRelativeUrl
())
self
.
assertFalse
(
message
in
self
.
getMessageList
(
invoice
))
resource
=
self
.
portal
.
service_module
.
newContent
(
portal_type
=
'Service'
)
setter
(
resource
.
getRelativeUrl
())
self
.
assertTrue
(
message
in
self
.
getMessageList
(
invoice
))
def
test_price_currency
(
self
):
raise
NotImplementedError
invoice
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
)
message
=
"Arity Error for Relation ['price_currency'], arity is equal "
\
"to 0 but should be between 1 and 1"
self
.
_test_currency
(
invoice
,
invoice
.
setPriceCurrency
,
message
)
def
test_resource
(
self
):
raise
NotImplementedError
invoice
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
)
message
=
"Arity Error for Relation ['resource'], arity is equal "
\
"to 0 but should be between 1 and 1"
self
.
_test_currency
(
invoice
,
invoice
.
setResource
,
message
)
@
withAbort
def
test_sale_invoice_specialise_sale_trade_condition_constraint
(
self
):
raise
NotImplementedError
invoice
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
)
setter
=
invoice
.
setSpecialise
message
=
"Arity Error for Relation ['specialise'], arity is equal "
\
"to 0 but should be at least 1"
self
.
assertTrue
(
message
in
self
.
getMessageList
(
invoice
))
sale_condition
=
self
.
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
'Sale Trade Condition'
)
setter
(
sale_condition
.
getRelativeUrl
())
self
.
assertFalse
(
message
in
self
.
getMessageList
(
invoice
))
purchase_condition
=
self
.
portal
.
purchase_trade_condition_module
.
newContent
(
portal_type
=
'Purchase Trade Condition'
)
setter
(
purchase_condition
.
getRelativeUrl
())
self
.
assertTrue
(
message
in
self
.
getMessageList
(
invoice
))
@
withAbort
def
test_specialise_value
(
self
):
raise
NotImplementedError
invoice
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
)
message
=
"Only SlapOS trade condition is allowed"
self
.
assertTrue
(
message
in
self
.
getMessageList
(
invoice
))
sale_condition
=
self
.
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
'Sale Trade Condition'
)
invoice
.
setSpecialise
(
sale_condition
.
getRelativeUrl
())
self
.
assertTrue
(
message
in
self
.
getMessageList
(
invoice
))
invoice
.
setSpecialise
(
'sale_trade_condition_module/slapos_trade_condition'
)
self
.
assertFalse
(
message
in
self
.
getMessageList
(
invoice
))
@
withAbort
def
test_total_price_equal_accounting
(
self
):
raise
NotImplementedError
message
=
"Total price of invoice does not match accounting"
invoice
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
,
price_currency
=
'currency_module/EUR'
)
invoice
.
newContent
(
portal_type
=
'Invoice Line'
,
quantity
=
1.
,
price
=
1.
)
self
.
assertFalse
(
message
in
self
.
getMessageList
(
invoice
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice
,
'confirmed'
)
self
.
assertTrue
(
message
in
self
.
getMessageList
(
invoice
))
invoice
.
receivable
.
setQuantity
(
-
1.0
)
invoice
.
income
.
setQuantity
(
1.0
)
self
.
assertFalse
(
message
in
self
.
getMessageList
(
invoice
))
@
withAbort
def
test_trade_model_match_lines
(
self
):
raise
NotImplementedError
message
=
"Defined Trade Model does not match Lines definition"
invoice
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
,
price_currency
=
'currency_module/EUR'
,
specialise
=
'sale_trade_condition_module/slapos_trade_condition'
)
invoice
.
newContent
(
portal_type
=
'Invoice Line'
,
quantity
=
1.
,
price
=
1.
,
base_contribution
=
'base_amount/invoicing/taxable'
)
self
.
assertFalse
(
message
in
self
.
getMessageList
(
invoice
))
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice
,
'confirmed'
)
self
.
assertTrue
(
message
in
self
.
getMessageList
(
invoice
))
invoice
.
newContent
(
portal_type
=
'Invoice Line'
,
quantity
=
1.
,
price
=
.
196
,
use
=
'trade/tax'
,
)
self
.
assertFalse
(
message
in
self
.
getMessageList
(
invoice
))
master/bt5/slapos_accounting/bt/revision
View file @
e0026786
95
\ No newline at end of file
96
\ No newline at end of file
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