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
Arnaud Véron
slapos.core
Commits
e815727a
Commit
e815727a
authored
Nov 10, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
Minor Fixups and add tests
See merge request
nexedi/slapos.core!447
parents
1a2b1504
59ebd777
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
115 additions
and
36 deletions
+115
-36
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
.../portal_components/test.erp5.testSlapOSAccountingSkins.py
+105
-10
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.xml
...portal_components/test.erp5.testSlapOSAccountingSkins.xml
+3
-24
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSCodingStyle.py
...Item/portal_components/test.erp5.testSlapOSCodingStyle.py
+5
-2
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SaleInvoiceTransaction_viewAsHateoas.xml
...s_hal_json_style/SaleInvoiceTransaction_viewAsHateoas.xml
+2
-0
No files found.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
View file @
e815727a
# -*- coding: utf
-
8 -*-
# -*- coding: utf8 -*-
##############################################################################
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
,
withAbort
,
simulate
from
zExceptions
import
Unauthorized
...
...
@@ -29,7 +51,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
)
@
withAbort
def
test_
HS
_calculateSubscriptionStartDate_REQUEST_disallowed
(
self
):
def
test_
IT
_calculateSubscriptionStartDate_REQUEST_disallowed
(
self
):
item
=
self
.
createInstanceTree
()
self
.
assertRaises
(
Unauthorized
,
...
...
@@ -37,14 +59,14 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
REQUEST
=
{})
@
withAbort
def
test_
HS
_calculateSubscriptionStartDate_noWorkflow
(
self
):
def
test_
IT
_calculateSubscriptionStartDate_noWorkflow
(
self
):
item
=
self
.
createInstanceTree
()
item
.
workflow_history
[
'instance_slap_interface_workflow'
]
=
[]
date
=
item
.
InstanceTree_calculateSubscriptionStartDate
()
self
.
assertEqual
(
date
,
item
.
getCreationDate
().
earliestTime
())
@
withAbort
def
test_
HS
_calculateSubscriptionStartDate_withRequest
(
self
):
def
test_
IT
_calculateSubscriptionStartDate_withRequest
(
self
):
item
=
self
.
createInstanceTree
()
item
.
workflow_history
[
'instance_slap_interface_workflow'
]
=
[{
'comment'
:
'Directly request the instance'
,
...
...
@@ -58,7 +80,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
self
.
assertEqual
(
date
,
DateTime
(
'2012/11/15'
))
@
withAbort
def
test_
HS
_calculateSubscriptionStartDate_withRequestEndOfMonth
(
self
):
def
test_
IT
_calculateSubscriptionStartDate_withRequestEndOfMonth
(
self
):
item
=
self
.
createInstanceTree
()
item
.
workflow_history
[
'instance_slap_interface_workflow'
]
=
[{
'comment'
:
'Directly request the instance'
,
...
...
@@ -72,7 +94,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
self
.
assertEqual
(
date
,
DateTime
(
'2012/11/30'
))
@
withAbort
def
test_
HS
_calculateSubscriptionStartDate_withRequestAfterDestroy
(
self
):
def
test_
IT
_calculateSubscriptionStartDate_withRequestAfterDestroy
(
self
):
item
=
self
.
createInstanceTree
()
destroy_date
=
DateTime
(
'2012/10/30 11:11'
)
request_date
=
DateTime
(
'2012/11/30 11:11'
)
...
...
@@ -97,7 +119,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
self
.
assertEqual
(
date
,
DateTime
(
'2012/10/30'
))
@
withAbort
def
test_
HS
_calculateSubscriptionStopDate_REQUEST_disallowed
(
self
):
def
test_
IT
_calculateSubscriptionStopDate_REQUEST_disallowed
(
self
):
item
=
self
.
createInstanceTree
()
self
.
assertRaises
(
Unauthorized
,
...
...
@@ -105,7 +127,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
REQUEST
=
{})
@
withAbort
def
test_
HS
_calculateSubscriptionStopDate_withDestroy
(
self
):
def
test_
IT
_calculateSubscriptionStopDate_withDestroy
(
self
):
item
=
self
.
createInstanceTree
()
destroy_date
=
DateTime
(
'2012/10/30'
)
item
.
workflow_history
[
'instance_slap_interface_workflow'
].
append
({
...
...
@@ -120,7 +142,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
self
.
assertEqual
(
date
,
DateTime
(
'2012/10/31'
))
@
withAbort
def
test_
HS
_calculateSubscriptionStopDate_noDestroy
(
self
):
def
test_
IT
_calculateSubscriptionStopDate_noDestroy
(
self
):
item
=
self
.
createInstanceTree
()
item
.
workflow_history
[
'instance_slap_interface_workflow'
]
=
[]
date
=
item
.
InstanceTree_calculateSubscriptionStopDate
()
...
...
@@ -248,4 +270,77 @@ return context.getParentValue()""")
self
.
assertRaises
(
Unauthorized
,
sale_invoice_transaction
.
SaleInvoiceTransaction_resetPaymentMode
,
REQUEST
=
{})
\ No newline at end of file
REQUEST
=
{})
def
test_Person_get_set_AggregatedDelivery
(
self
):
person
=
self
.
makePerson
()
self
.
assertEqual
(
person
.
Person_getAggregatedDelivery
(),
None
)
delivery
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
portal_type
=
"Sale Packing List"
)
person
.
Person_setAggregatedDelivery
(
delivery
)
self
.
assertEqual
(
delivery
,
person
.
Person_getAggregatedDelivery
())
def
test_AccountingTransactionModule_getUnpaidInvoiceList
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
payment_template
=
self
.
portal
.
restrictedTraverse
(
self
.
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentTemplate
())
payment
=
payment_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
for
line
in
payment
.
contentValues
():
if
line
.
getSource
()
==
"account_module/payment_to_encash"
:
line
.
setQuantity
(
-
1
)
elif
line
.
getSource
()
==
"account_module/receivable"
:
line
.
setQuantity
(
1
)
payment
.
confirm
()
payment
.
start
()
template
=
self
.
portal
.
restrictedTraverse
(
self
.
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate
())
current_invoice
=
template
.
Base_createCloneDocument
(
batch_mode
=
1
)
current_invoice
.
edit
(
destination_value
=
person
,
destination_section_value
=
person
,
destination_decision_value
=
person
,
start_date
=
DateTime
(
'2019/10/20'
),
stop_date
=
DateTime
(
'2019/10/20'
),
title
=
'Fake Invoice for Demo User Functional'
,
price_currency
=
"currency_module/EUR"
,
reference
=
'1'
)
cell
=
current_invoice
[
"1"
][
"movement_0"
]
cell
.
edit
(
quantity
=
1
)
cell
.
setPrice
(
1
)
payment
.
setCausalityValue
(
current_invoice
)
payment
.
setDestinationSectionValue
(
person
)
current_invoice
.
plan
()
current_invoice
.
confirm
()
current_invoice
.
startBuilding
()
current_invoice
.
reindexObject
()
current_invoice
.
stop
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
assertEqual
(
self
.
portal
.
accounting_module
.
AccountingTransactionModule_getUnpaidInvoiceList
(),
[
current_invoice
])
self
.
login
()
payment
.
stop
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
assertEqual
(
self
.
portal
.
accounting_module
.
AccountingTransactionModule_getUnpaidInvoiceList
(),
[])
\ No newline at end of file
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.xml
View file @
e815727a
...
...
@@ -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>
testSlapOSAccountingSkins
</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>
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSCodingStyle.py
View file @
e815727a
...
...
@@ -49,6 +49,11 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
slapos_cloud/PreferenceTemplateItem/portal_preferences/slapos_default_system_preference.xml
slapos_cloud/PreferenceTemplateItem/portal_preferences/slapos_default_site_preference.xml
# Since the sections can be overwriten on project context, keep it on ignore list.
slapos_jio/PathTemplateItem/web_site_module/hostingjs/feed.xml
slapos_jio/PathTemplateItem/web_site_module/hostingjs/feed/critical.xml
slapos_jio/PathTemplateItem/web_site_module/hostingjs/feed/invoice.xml
# WebSite is updated after the installation to re-generate the translation data.
# This list should be reconsider later so we can keep information accurated.
slapos_jio/PathTemplateItem/web_site_module/hostingjs.xml
...
...
@@ -174,8 +179,6 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
'slapos_accounting/OrderBuilder_selectSlapOSAggregatedDeliveryList'
,
'slapos_accounting/PaymentTransaction_getExternalPaymentId'
,
'slapos_accounting/PaymentTransaction_postOrderBuild'
,
'slapos_accounting/Person_getAggregatedDelivery'
,
'slapos_accounting/Person_setAggregatedDelivery'
,
'slapos_accounting/SaleInvoiceTransaction_init'
,
'slapos_accounting/SaleInvoiceTransaction_isTotalPriceEqualAccounting'
,
'slapos_accounting/SaleInvoiceTransaction_isTotalPriceMatchingSalePackingList'
,
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SaleInvoiceTransaction_viewAsHateoas.xml
View file @
e815727a
...
...
@@ -99,6 +99,8 @@
<string>
my_total_price
</string>
<string>
my_resource_title
</string>
<string>
my_payment_transaction_external_id
</string>
<string>
my_payment_state
</string>
<string>
my_payment_transaction
</string>
</list>
</value>
</item>
...
...
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