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
77d24799
Commit
77d24799
authored
Sep 22, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: test: SoftwareInstance_requestValidationPayment was dropped
parent
355fb709
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
219 deletions
+3
-219
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSContractSkins.py
...em/portal_components/test.erp5.testSlapOSContractSkins.py
+0
-195
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSContractSkins.xml
...m/portal_components/test.erp5.testSlapOSContractSkins.xml
+3
-24
No files found.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSContractSkins.py
View file @
77d24799
...
...
@@ -2,201 +2,6 @@
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
,
simulate
from
DateTime
import
DateTime
from
zExceptions
import
Unauthorized
class
TestSlapOSSoftwareInstance_requestValidationPayment
(
SlapOSTestCaseMixinWithAbort
):
def
createCloudContract
(
self
):
new_id
=
self
.
generateNewId
()
contract
=
self
.
portal
.
cloud_contract_module
.
newContent
(
portal_type
=
'Cloud Contract'
,
title
=
"Contract %s"
%
new_id
,
reference
=
"TESTCONTRACT-%s"
%
new_id
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
contract
,
'invalidated'
)
return
contract
def
createPaymentTransaction
(
self
):
new_id
=
self
.
generateNewId
()
return
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment %s"
%
new_id
,
reference
=
"TESTPAY-%s"
%
new_id
,
)
def
createInvoiceTransaction
(
self
):
new_id
=
self
.
generateNewId
()
return
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
,
title
=
"Invoice %s"
%
new_id
,
reference
=
"TESTINV-%s"
%
new_id
,
created_by_builder
=
1
,
)
def
createNeededDocuments
(
self
):
new_id
=
self
.
generateNewId
()
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
title
=
"Person %s"
%
new_id
,
reference
=
"TESTPERS-%s"
%
new_id
,
)
subscription
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
title
=
"Subscription %s"
%
new_id
,
reference
=
"TESTSUB-%s"
%
new_id
,
destination_section_value
=
person
,
)
instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Software Instance'
,
title
=
"Instance %s"
%
new_id
,
reference
=
"TESTINST-%s"
%
new_id
,
specialise_value
=
subscription
,
)
return
person
,
instance
,
subscription
def
test_requestValidationPayment_REQUEST_disallowed
(
self
):
_
,
instance
,
_
=
self
.
createNeededDocuments
()
self
.
assertRaises
(
Unauthorized
,
instance
.
SoftwareInstance_requestValidationPayment
,
REQUEST
=
{})
def
test_prevent_concurrency
(
self
):
person
,
instance
,
_
=
self
.
createNeededDocuments
()
tag
=
"%s_requestValidationPayment_inProgress"
%
person
.
getUid
()
person
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
self
.
commit
()
result
=
instance
.
SoftwareInstance_requestValidationPayment
()
self
.
assertEqual
(
result
,
None
)
def
test_addCloudContract
(
self
):
person
,
instance
,
_
=
self
.
createNeededDocuments
()
contract
=
instance
.
SoftwareInstance_requestValidationPayment
()
# Default property
self
.
assertEqual
(
contract
.
getPortalType
(),
'Cloud Contract'
)
self
.
assertEqual
(
contract
.
getValidationState
(),
'invalidated'
)
self
.
assertEqual
(
contract
.
getDestinationSection
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
contract
.
getTitle
(),
'Contract for "%s"'
%
person
.
getTitle
())
def
test_addCloudContract_do_not_duplicate_contract_if_not_reindexed
(
self
):
_
,
instance
,
_
=
self
.
createNeededDocuments
()
contract
=
instance
.
SoftwareInstance_requestValidationPayment
()
self
.
commit
()
contract2
=
instance
.
SoftwareInstance_requestValidationPayment
()
self
.
assertNotEqual
(
contract
,
None
)
self
.
assertEqual
(
contract2
,
None
)
def
test_addCloudContract_existing_invalidated_contract
(
self
):
_
,
instance
,
_
=
self
.
createNeededDocuments
()
contract
=
instance
.
SoftwareInstance_requestValidationPayment
()
self
.
commit
()
self
.
tic
()
contract2
=
instance
.
SoftwareInstance_requestValidationPayment
()
self
.
assertNotEqual
(
contract
,
None
)
self
.
assertEqual
(
contract2
.
getRelativeUrl
(),
contract
.
getRelativeUrl
())
def
test_addCloudContract_existing_validated_contract
(
self
):
_
,
instance
,
_
=
self
.
createNeededDocuments
()
contract
=
instance
.
SoftwareInstance_requestValidationPayment
()
contract
.
validate
()
self
.
commit
()
self
.
tic
()
contract2
=
instance
.
SoftwareInstance_requestValidationPayment
()
self
.
assertNotEqual
(
contract
,
None
)
self
.
assertEqual
(
contract2
.
getRelativeUrl
(),
contract
.
getRelativeUrl
())
def
test_do_nothing_if_validated_contract
(
self
):
person
,
instance
,
_
=
self
.
createNeededDocuments
()
contract
=
self
.
createCloudContract
()
contract
.
edit
(
destination_section_value
=
person
)
contract
.
validate
()
self
.
tic
()
contract2
=
instance
.
SoftwareInstance_requestValidationPayment
()
self
.
assertEqual
(
contract2
.
getRelativeUrl
(),
contract
.
getRelativeUrl
())
self
.
assertEqual
(
contract2
.
getCausality
(
""
),
""
)
self
.
assertEqual
(
contract2
.
getValidationState
(),
"validated"
)
def
test_validate_contract_if_payment_found
(
self
):
person
,
instance
,
_
=
self
.
createNeededDocuments
()
contract
=
self
.
createCloudContract
()
contract
.
edit
(
destination_section_value
=
person
)
payment
=
self
.
createPaymentTransaction
()
payment
.
edit
(
default_destination_section_value
=
person
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'stopped'
)
self
.
assertEqual
(
contract
.
getValidationState
(),
"invalidated"
)
self
.
tic
()
contract2
=
instance
.
SoftwareInstance_requestValidationPayment
()
self
.
assertEqual
(
contract2
.
getRelativeUrl
(),
contract
.
getRelativeUrl
())
self
.
assertEqual
(
contract2
.
getCausality
(
""
),
""
)
self
.
assertEqual
(
contract2
.
getValidationState
(),
"validated"
)
def
test_do_nothing_if_invoice_is_ongoing
(
self
):
person
,
instance
,
_
=
self
.
createNeededDocuments
()
contract
=
self
.
createCloudContract
()
invoice
=
self
.
createInvoiceTransaction
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice
,
'confirmed'
)
contract
.
edit
(
destination_section_value
=
person
,
causality_value
=
invoice
,
)
self
.
assertEqual
(
contract
.
getValidationState
(),
"invalidated"
)
self
.
tic
()
contract2
=
instance
.
SoftwareInstance_requestValidationPayment
()
self
.
assertEqual
(
contract2
.
getRelativeUrl
(),
contract
.
getRelativeUrl
())
self
.
assertEqual
(
contract2
.
getCausality
(
""
),
invoice
.
getRelativeUrl
())
self
.
assertEqual
(
contract2
.
getValidationState
(),
"invalidated"
)
def
test_dont_forget_current_grouped_invoice
(
self
):
person
,
instance
,
_
=
self
.
createNeededDocuments
()
contract
=
self
.
createCloudContract
()
invoice
=
self
.
createInvoiceTransaction
()
line
=
invoice
.
newContent
(
portal_type
=
"Sale Invoice Transaction Line"
,
source
=
"account_module/receivable"
,
grouping_reference
=
"foo"
,
)
line
.
getSourceValue
().
getAccountType
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice
,
'stopped'
)
contract
.
edit
(
destination_section_value
=
person
,
causality_value
=
invoice
,
)
self
.
assertEqual
(
contract
.
getValidationState
(),
"invalidated"
)
self
.
tic
()
contract2
=
instance
.
SoftwareInstance_requestValidationPayment
()
self
.
assertEqual
(
contract2
.
getRelativeUrl
(),
contract
.
getRelativeUrl
())
self
.
assertEqual
(
contract2
.
getCausality
(
""
),
invoice
.
getRelativeUrl
())
self
.
assertEqual
(
contract2
.
getValidationState
(),
"invalidated"
)
def
test_do_nothing_if_invoice_is_not_grouped
(
self
):
person
,
instance
,
_
=
self
.
createNeededDocuments
()
contract
=
self
.
createCloudContract
()
invoice
=
self
.
createInvoiceTransaction
()
invoice
.
newContent
(
portal_type
=
"Sale Invoice Transaction Line"
,
source
=
"account_module/receivable"
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice
,
'stopped'
)
contract
.
edit
(
destination_section_value
=
person
,
causality_value
=
invoice
,
)
self
.
assertEqual
(
contract
.
getValidationState
(),
"invalidated"
)
self
.
tic
()
contract2
=
instance
.
SoftwareInstance_requestValidationPayment
()
self
.
assertEqual
(
contract2
.
getRelativeUrl
(),
contract
.
getRelativeUrl
())
self
.
assertEqual
(
contract2
.
getCausality
(
""
),
invoice
.
getRelativeUrl
())
self
.
assertEqual
(
contract2
.
getValidationState
(),
"invalidated"
)
class
TestSlapOSPerson_isAllowedToAllocate
(
SlapOSTestCaseMixinWithAbort
):
...
...
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSContractSkins.xml
View file @
77d24799
...
...
@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSContractSkins
</string>
</value>
...
...
@@ -55,28 +49,13 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -89,7 +68,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -98,7 +77,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
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