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
195b0201
Commit
195b0201
authored
Oct 20, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: test: drop unused functions
parent
98723e31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
182 deletions
+0
-182
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
...omponents/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
+0
-182
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
View file @
195b0201
...
...
@@ -199,23 +199,6 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
server
.
edit
(
capacity_scope
=
'open'
)
self
.
tic
()
@
changeSkin
(
'RJS'
)
def
setServerOpenSubscription
(
self
,
server
):
server
.
edit
(
allocation_scope
=
'open/subscription'
)
self
.
assertEqual
(
'open/subscription'
,
server
.
getAllocationScope
())
self
.
assertEqual
(
'close'
,
server
.
getCapacityScope
())
server
.
edit
(
capacity_scope
=
'open'
)
self
.
tic
()
@
changeSkin
(
'RJS'
)
def
setServerOpenPersonal
(
self
,
server
):
server
.
edit
(
allocation_scope
=
'open/personal'
,
subject_list
=
[])
self
.
assertEqual
(
'open/personal'
,
server
.
getAllocationScope
())
self
.
assertEqual
(
'open'
,
server
.
getCapacityScope
())
self
.
tic
()
def
formatComputeNode
(
self
,
compute_node
,
partition_count
=
10
):
compute_node_dict
=
dict
(
software_root
=
'/opt'
,
...
...
@@ -637,122 +620,6 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
partition
.
contentValues
(
portal_type
=
'Internet Protocol Address'
)],
connection_dict
.
values
())
def
assertInstanceTreeSimulationCoverage
(
self
,
subscription
):
self
.
login
()
# this is document level assertion, as simulation and its specific delivery
# is covered by unit tests
packing_list_line_list
=
subscription
.
getAggregateRelatedValueList
(
portal_type
=
'Sale Packing List Line'
)
self
.
assertEqual
(
len
(
packing_list_line_list
),
1
)
for
packing_list_line
in
packing_list_line_list
:
packing_list
=
packing_list_line
.
getParentValue
()
self
.
assertEqual
(
'Sale Packing List'
,
packing_list
.
getPortalType
())
self
.
assertEqual
(
'delivered'
,
packing_list
.
getSimulationState
())
causality_state
=
packing_list
.
getCausalityState
()
self
.
assertEqual
(
'solved'
,
causality_state
)
def
assertAggregatedSalePackingList
(
self
,
delivery
):
self
.
assertEqual
(
'delivered'
,
delivery
.
getSimulationState
())
self
.
assertEqual
(
'solved'
,
delivery
.
getCausalityState
())
invoice_list
=
delivery
.
getCausalityRelatedValueList
(
portal_type
=
'Sale Invoice Transaction'
)
self
.
assertEqual
(
1
,
len
(
invoice_list
))
invoice
=
invoice_list
[
0
].
getObject
()
causality_list
=
invoice
.
getCausalityValueList
()
self
.
assertSameSet
([
delivery
],
causality_list
)
self
.
assertEqual
(
'stopped'
,
invoice
.
getSimulationState
())
self
.
assertEqual
(
'solved'
,
invoice
.
getCausalityState
())
payment_list
=
invoice
.
getCausalityRelatedValueList
(
portal_type
=
'Payment Transaction'
)
self
.
assertEqual
(
0
,
len
(
payment_list
))
def
assertPersonDocumentCoverage
(
self
,
person
):
self
.
login
()
subscription_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Instance Tree'
,
default_destination_section_uid
=
person
.
getUid
())
for
subscription
in
subscription_list
:
self
.
assertInstanceTreeSimulationCoverage
(
subscription
.
getObject
())
aggregated_delivery_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Sale Packing List'
,
default_destination_section_uid
=
person
.
getUid
(),
specialise_uid
=
[
self
.
portal
.
restrictedTraverse
(
self
.
portal
\
.
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
()
\
).
getUid
()
]
+
[
i
.
uid
for
i
in
self
.
portal
.
ERP5Site_searchRelatedInheritedSpecialiseList
(
specialise_uid
=
self
.
portal
.
restrictedTraverse
(
self
.
portal
.
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
()
).
getUid
())
]
)
if
len
(
subscription_list
)
==
0
:
self
.
assertEqual
(
0
,
len
(
aggregated_delivery_list
))
return
self
.
assertNotEqual
(
0
,
len
(
aggregated_delivery_list
))
for
aggregated_delivery
in
aggregated_delivery_list
:
self
.
assertAggregatedSalePackingList
(
aggregated_delivery
.
getObject
())
def
assertOpenSaleOrderCoverage
(
self
,
person_reference
):
self
.
login
()
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'ERP5 Login'
,
reference
=
person_reference
).
getParentValue
()
instance_tree_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Instance Tree'
,
default_destination_section_uid
=
person
.
getUid
()
)
open_sale_order_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Open Sale Order'
,
default_destination_uid
=
person
.
getUid
(),
)
if
len
(
instance_tree_list
)
==
0
:
self
.
assertEqual
(
0
,
len
(
open_sale_order_list
))
return
self
.
assertEqual
(
len
(
instance_tree_list
),
len
(
open_sale_order_list
))
archived_open_sale_order_list
=
[
q
for
q
in
open_sale_order_list
if
q
.
getValidationState
()
==
'archived'
]
self
.
assertEqual
(
len
(
instance_tree_list
),
len
(
archived_open_sale_order_list
))
line_list
=
[]
for
open_sale_order
in
archived_open_sale_order_list
:
archived_line_list
=
open_sale_order
.
contentValues
(
portal_type
=
'Open Sale Order Line'
)
self
.
assertEqual
(
1
,
len
(
archived_line_list
))
line_list
.
extend
(
archived_line_list
)
self
.
assertEqual
(
len
(
instance_tree_list
),
len
(
line_list
))
self
.
assertSameSet
(
[
q
.
getRelativeUrl
()
for
q
in
instance_tree_list
],
[
q
.
getAggregate
(
portal_type
=
"Instance Tree"
)
for
q
in
line_list
]
)
# Every line must have 2 aggregate categories:
# one Instance Tree and one Hosting Subscription
for
line
in
line_list
:
self
.
assertEqual
(
2
,
len
(
line
.
getAggregateList
()))
self
.
assertEqual
(
1
,
len
(
line
.
getAggregateList
(
portal_type
=
"Hosting Subscription"
)))
validated_open_sale_order_list
=
[
q
for
q
in
open_sale_order_list
if
q
.
getValidationState
()
==
'validated'
]
# if no line, all open orders are kept archived
self
.
assertEqual
(
len
(
validated_open_sale_order_list
),
0
)
def
findMessage
(
self
,
email
,
body
):
for
candidate
in
reversed
(
self
.
portal
.
MailHost
.
getMessageList
()):
if
[
q
for
q
in
candidate
[
1
]
if
email
in
q
]
and
body
in
candidate
[
2
]:
...
...
@@ -772,55 +639,6 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
else
:
self
.
assertEqual
(
None
,
to_click_message
)
@
changeSkin
(
'RJS'
)
def
usePaymentManually
(
self
,
web_site
,
user_id
,
is_email_expected
=
True
,
subscription_request
=
None
):
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Person"
,
user_id
=
user_id
)
self
.
assertNotEqual
(
person
,
None
)
self
.
assertInvoiceNotification
(
person
,
is_email_expected
)
invoice_list
=
person
.
Entity_getOutstandingAmountList
()
self
.
login
()
if
subscription_request
is
not
None
:
expected_causality
=
subscription_request
.
getRelativeUrl
()
filtered_invoice_list
=
[]
for
invoice
in
invoice_list
:
spl
=
invoice
.
getCausalityValue
()
if
spl
is
not
None
and
spl
.
getCausality
()
==
expected_causality
:
filtered_invoice_list
.
append
(
invoice
)
self
.
assertEqual
(
len
(
filtered_invoice_list
),
1
)
invoice_list
=
filtered_invoice_list
else
:
self
.
assertEqual
(
len
(
invoice_list
),
1
)
self
.
login
(
user_id
)
document_id
=
invoice_list
[
0
].
getId
()
web_site
.
accounting_module
[
document_id
].
\
SaleInvoiceTransaction_redirectToManualSlapOSPayment
()
self
.
tic
()
def
assertSubscriptionStopped
(
self
,
person
):
self
.
login
()
subscription_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Instance Tree'
,
default_destination_section_uid
=
person
.
getUid
())
self
.
assertEqual
(
len
(
subscription_list
),
1
)
for
subscription
in
subscription_list
:
self
.
assertEqual
(
subscription
.
getSlapState
(),
"stop_requested"
)
def
assertSubscriptionDestroyed
(
self
,
person
):
self
.
login
()
subscription_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Instance Tree'
,
default_destination_section_uid
=
person
.
getUid
())
self
.
assertEqual
(
len
(
subscription_list
),
1
)
for
subscription
in
subscription_list
:
self
.
assertEqual
(
subscription
.
getSlapState
(),
"destroy_requested"
)
def
requestInstance
(
self
,
person_user_id
,
instance_title
,
software_release
,
software_type
,
project_reference
):
...
...
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