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
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
3b4d4028
Commit
3b4d4028
authored
Apr 16, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py3: 2to3 -j 20 --write --nobackups --no-diffs --fix=asserts master
parent
0ede1d85
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
54 deletions
+54
-54
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5AccountingScenario.py
..._components/test.erp5.testSlapOSERP5AccountingScenario.py
+23
-23
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudSkins.py
...eItem/portal_components/test.erp5.testSlapOSCloudSkins.py
+13
-13
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5CRMScenario.py
.../portal_components/test.erp5.testSlapOSERP5CRMScenario.py
+18
-18
No files found.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5AccountingScenario.py
View file @
3b4d4028
...
...
@@ -40,8 +40,8 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
(
include_planned
=
True
))
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
include_planned
=
True
)
self
.
assertEqual
s
(
len
(
amount_list
),
1
)
self
.
assertEqual
s
(
amount_list
[
0
].
total_price
,
24.384
)
self
.
assertEqual
(
len
(
amount_list
),
1
)
self
.
assertEqual
(
amount_list
[
0
].
total_price
,
24.384
)
self
.
assertFalse
(
owner_person
.
Entity_hasOutstandingAmount
())
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"invalidated"
)
open_sale_order
=
self
.
portal
.
portal_catalog
.
getResultValue
(
...
...
@@ -80,12 +80,12 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
(
include_planned
=
True
))
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
include_planned
=
True
)
self
.
assertEqual
s
(
len
(
amount_list
),
1
)
self
.
assertEqual
s
(
amount_list
[
0
].
total_price
,
175.584
)
self
.
assertEqual
(
len
(
amount_list
),
1
)
self
.
assertEqual
(
amount_list
[
0
].
total_price
,
175.584
)
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
())
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
()
self
.
assertEqual
s
(
len
(
amount_list
),
1
)
self
.
assertEqual
s
(
amount_list
[
0
].
total_price
,
125.184
)
self
.
assertEqual
(
len
(
amount_list
),
1
)
self
.
assertEqual
(
amount_list
[
0
].
total_price
,
125.184
)
self
.
assertEqual
(
first_invoice
.
getSimulationState
(),
"stopped"
)
# Ensure no unexpected object has been created
# 4 accounting transactions
...
...
@@ -110,16 +110,16 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
)
)
payment_transaction
.
stop
()
self
.
assertEqual
s
(
payment_transaction
.
AccountingTransaction_getTotalCredit
(),
74.78399999999999
)
self
.
assertEqual
(
payment_transaction
.
AccountingTransaction_getTotalCredit
(),
74.78399999999999
)
self
.
tic
()
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
(
include_planned
=
True
))
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
include_planned
=
True
)
self
.
assertEqual
s
(
len
(
amount_list
),
1
)
self
.
assertEqual
s
(
amount_list
[
0
].
total_price
,
100.8
)
self
.
assertEqual
(
len
(
amount_list
),
1
)
self
.
assertEqual
(
amount_list
[
0
].
total_price
,
100.8
)
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
())
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
()
self
.
assertEqual
s
(
len
(
amount_list
),
1
)
self
.
assertEqual
s
(
amount_list
[
0
].
total_price
,
50.4
)
self
.
assertEqual
(
len
(
amount_list
),
1
)
self
.
assertEqual
(
amount_list
[
0
].
total_price
,
50.4
)
self
.
assertTrue
(
first_invoice
.
SaleInvoiceTransaction_isLettered
())
# Ensure no unexpected object has been created
self
.
assertRelatedObjectCount
(
project
,
22
)
...
...
@@ -136,15 +136,15 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
)
)
payment_transaction
.
stop
()
self
.
assertEqual
s
(
payment_transaction
.
AccountingTransaction_getTotalCredit
(),
50.4
)
self
.
assertEqual
(
payment_transaction
.
AccountingTransaction_getTotalCredit
(),
50.4
)
self
.
tic
()
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
(
include_planned
=
True
))
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
include_planned
=
True
)
self
.
assertEqual
s
(
len
(
amount_list
),
1
)
self
.
assertEqual
s
(
amount_list
[
0
].
total_price
,
50.4
)
self
.
assertEqual
(
len
(
amount_list
),
1
)
self
.
assertEqual
(
amount_list
[
0
].
total_price
,
50.4
)
self
.
assertFalse
(
owner_person
.
Entity_hasOutstandingAmount
())
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
()
self
.
assertEqual
s
(
len
(
amount_list
),
0
)
self
.
assertEqual
(
len
(
amount_list
),
0
)
# Ensure no unexpected object has been created
self
.
assertRelatedObjectCount
(
project
,
22
)
...
...
@@ -236,7 +236,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
logout
()
self
.
login
()
# Check that no activity has been triggered yet
self
.
assertEqual
s
(
self
.
portal
.
portal_catalog
.
countResults
(
self
.
assertEqual
(
self
.
portal
.
portal_catalog
.
countResults
(
portal_type
=
'Compute Node'
,
follow_up__uid
=
project
.
getUid
()
)[
0
][
0
],
0
)
...
...
@@ -246,7 +246,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
# 1 invoice for the compute node
# per user:
# 1 monthly invoice for products
self
.
assertEqual
s
(
self
.
portal
.
portal_catalog
.
countResults
(
self
.
assertEqual
(
self
.
portal
.
portal_catalog
.
countResults
(
portal_type
=
'Sale Invoice Transaction'
,
source_project__uid
=
project
.
getUid
()
)[
0
][
0
],
1
+
len
(
person_list
))
...
...
@@ -271,7 +271,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
# Execute activities for all services
# To try detection bad activity tag dependencies
self
.
tic
()
self
.
assertEqual
s
(
self
.
portal
.
portal_catalog
.
countResults
(
self
.
assertEqual
(
self
.
portal
.
portal_catalog
.
countResults
(
portal_type
=
'Sale Invoice Transaction'
,
source_project__uid
=
project
.
getUid
()
)[
0
][
0
],
1
+
len
(
person_list
))
...
...
@@ -283,7 +283,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
login
()
self
.
portal
.
portal_alarms
.
update_open_order_simulation
.
activeSense
()
self
.
tic
()
self
.
assertEqual
s
(
self
.
portal
.
portal_catalog
.
countResults
(
self
.
assertEqual
(
self
.
portal
.
portal_catalog
.
countResults
(
portal_type
=
'Sale Invoice Transaction'
,
source_project__uid
=
project
.
getUid
()
)[
0
][
0
],
(
1
+
len
(
person_list
))
*
3
)
...
...
@@ -327,15 +327,15 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
parent_uid
=
invoice
.
getUid
(),
resource__uid
=
self
.
portal
.
service_module
.
slapos_tax
.
getUid
()
)
self
.
assertEqual
s
(
tax_line
.
getPrice
(),
0
)
self
.
assertEqual
s
(
invoice
.
getTotalPrice
(),
42
)
self
.
assertEqual
(
tax_line
.
getPrice
(),
0
)
self
.
assertEqual
(
invoice
.
getTotalPrice
(),
42
)
with
PinnedDateTime
(
self
,
creation_date
+
35
):
self
.
portal
.
portal_alarms
.
update_open_order_simulation
.
activeSense
()
self
.
tic
()
self
.
assertEqual
s
(
invoice
.
getTotalPrice
(),
42
)
self
.
assertEqual
s
(
invoice
.
getSimulationState
(),
'stopped'
)
self
.
assertEqual
(
invoice
.
getTotalPrice
(),
42
)
self
.
assertEqual
(
invoice
.
getSimulationState
(),
'stopped'
)
# Ensure no unexpected object has been created
# 2 invoice lines
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudSkins.py
View file @
3b4d4028
...
...
@@ -75,7 +75,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
# check that alarm was called after the object was reindexed
self
.
assertTrue
(
next_indexation_timestamp
<
edit_timestamp
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -101,11 +101,11 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
next_indexation_timestamp
=
self
.
getIndexationDate
(
document
)
edit_timestamp
=
alarm
.
getModificationDate
()
# check that the document was not reindexed
self
.
assertEqual
s
(
previous_indexation_timestamp
,
next_indexation_timestamp
)
self
.
assertEqual
(
previous_indexation_timestamp
,
next_indexation_timestamp
)
# check that alarm was called after the object was reindexed
self
.
assertTrue
(
next_indexation_timestamp
<
edit_timestamp
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -129,9 +129,9 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
next_indexation_timestamp
=
self
.
getIndexationDate
(
document
)
# check that the document was not reindex
self
.
assertEqual
s
(
previous_indexation_timestamp
,
next_indexation_timestamp
)
self
.
assertEqual
(
previous_indexation_timestamp
,
next_indexation_timestamp
)
# check that the alarm was not triggered
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
)
...
...
@@ -157,7 +157,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
# check that alarm was called ONCE after the object was reindexed
self
.
assertTrue
(
next_indexation_timestamp
<
edit_timestamp
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -182,7 +182,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
self
.
tic
()
# check that alarm was called ONCE
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -213,7 +213,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
# check that alarm was called ONCE after the object was reindexed
self
.
assertTrue
(
next_indexation_timestamp
<
edit_timestamp
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -241,7 +241,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
with
TemporaryAlarmScript
(
alarm
,
'Alarm_allocateInstance'
):
self
.
tic
()
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
3
)
...
...
@@ -277,7 +277,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
self
.
assertTrue
(
next_indexation_timestamp1
<
edit_timestamp
)
self
.
assertTrue
(
next_indexation_timestamp2
<
edit_timestamp
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -314,7 +314,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
self
.
assertTrue
(
next_indexation_timestamp1
<
edit_timestamp
)
self
.
assertTrue
(
next_indexation_timestamp2
<
edit_timestamp
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -349,7 +349,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
self
.
assertTrue
(
next_indexation_timestamp
<
edit_timestamp1
)
self
.
assertTrue
(
next_indexation_timestamp
<
edit_timestamp2
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm1
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count1
+
1
)
...
...
@@ -357,7 +357,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
'Visited by Alarm_allocateInstance'
,
alarm1
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
]
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm2
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count2
+
1
)
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5CRMScenario.py
View file @
3b4d4028
...
...
@@ -101,7 +101,7 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin):
portal_type
=
'Regularisation Request'
,
destination__uid
=
owner_person
.
getUid
()
)
self
.
assertEqual
s
(
regularisation_request
.
getSimulationState
(),
'suspended'
)
self
.
assertEqual
(
regularisation_request
.
getSimulationState
(),
'suspended'
)
##################################################
# Trigger regularisation request escalation
...
...
@@ -124,21 +124,21 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin):
# Items must be deleted
# Open Order must be archived
# Invoice must be paid with Deposit
self
.
assertEqual
s
(
project
.
getValidationState
(),
'invalidated'
)
self
.
assertEqual
s
(
instance_tree
.
getValidationState
(),
'archived'
)
self
.
assertEqual
s
(
instance_tree
.
getSlapState
(),
'destroy_requested'
)
self
.
assertEqual
s
(
compute_node
.
getValidationState
(),
'invalidated'
)
self
.
assertEqual
(
project
.
getValidationState
(),
'invalidated'
)
self
.
assertEqual
(
instance_tree
.
getValidationState
(),
'archived'
)
self
.
assertEqual
(
instance_tree
.
getSlapState
(),
'destroy_requested'
)
self
.
assertEqual
(
compute_node
.
getValidationState
(),
'invalidated'
)
open_order_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Open Sale Order'
,
destination_section__uid
=
owner_person
.
getUid
()
)
hosting_subscription_list
=
[]
self
.
assertEqual
s
(
len
(
open_order_list
),
3
)
self
.
assertEqual
(
len
(
open_order_list
),
3
)
for
open_order
in
open_order_list
:
self
.
assertEqual
s
(
open_order
.
getValidationState
(),
'archived'
)
self
.
assertNotEqual
s
(
open_order
.
getStopDate
(),
open_order
.
getStartDate
())
self
.
assertNotEqual
s
(
open_order
.
getStopDate
(),
None
)
self
.
assertEqual
s
(
open_order
.
getStopDate
(),
DateTime
(
'2020/07/17'
))
self
.
assertEqual
(
open_order
.
getValidationState
(),
'archived'
)
self
.
assertNotEqual
(
open_order
.
getStopDate
(),
open_order
.
getStartDate
())
self
.
assertNotEqual
(
open_order
.
getStopDate
(),
None
)
self
.
assertEqual
(
open_order
.
getStopDate
(),
DateTime
(
'2020/07/17'
))
for
line
in
open_order
.
contentValues
():
for
cell
in
line
.
contentValues
():
...
...
@@ -149,12 +149,12 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin):
if
tmp
is
not
None
:
hosting_subscription_list
.
append
(
tmp
)
self
.
assertEqual
s
(
len
(
hosting_subscription_list
),
3
)
self
.
assertEqual
(
len
(
hosting_subscription_list
),
3
)
for
hosting_subscription
in
hosting_subscription_list
:
self
.
assertEqual
s
(
hosting_subscription
.
getValidationState
(),
'archived'
)
self
.
assertEqual
(
hosting_subscription
.
getValidationState
(),
'archived'
)
self
.
assertEqual
s
(
regularisation_request
.
getSimulationState
(),
'suspended'
)
self
.
assertEqual
s
(
regularisation_request
.
getResourceId
(),
self
.
assertEqual
(
regularisation_request
.
getSimulationState
(),
'suspended'
)
self
.
assertEqual
(
regularisation_request
.
getResourceId
(),
'slapos_crm_delete_acknowledgement'
)
# No planned invoice is expected
...
...
@@ -162,15 +162,15 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin):
outstanding_amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
ledger_uid
=
ledger_uid
)
self
.
assertEqual
s
(
len
(
outstanding_amount_list
),
1
)
self
.
assertEqual
s
(
outstanding_amount_list
[
0
].
total_price
,
132
)
self
.
assertEqual
(
len
(
outstanding_amount_list
),
1
)
self
.
assertEqual
(
outstanding_amount_list
[
0
].
total_price
,
132
)
planned_outstanding_amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
ledger_uid
=
ledger_uid
,
include_planned
=
True
)
self
.
assertEqual
s
(
len
(
planned_outstanding_amount_list
),
1
)
self
.
assertEqual
s
(
outstanding_amount_list
[
0
].
total_price
,
self
.
assertEqual
(
len
(
planned_outstanding_amount_list
),
1
)
self
.
assertEqual
(
outstanding_amount_list
[
0
].
total_price
,
planned_outstanding_amount_list
[
0
].
total_price
)
...
...
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