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
acff838f
Commit
acff838f
authored
Nov 07, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check that non instantiated SI does not raise.
parent
de8bdf26
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
51 deletions
+105
-51
master/product/Vifib/tests/testVifibSlapBug.py
master/product/Vifib/tests/testVifibSlapBug.py
+49
-0
master/product/Vifib/tests/testVifibSlapOpenOrderRequest.py
master/product/Vifib/tests/testVifibSlapOpenOrderRequest.py
+2
-51
master/product/Vifib/tests/testVifibSlapWebService.py
master/product/Vifib/tests/testVifibSlapWebService.py
+54
-0
No files found.
master/product/Vifib/tests/testVifibSlapBug.py
View file @
acff838f
from
Products.ERP5Type.tests.Sequence
import
SequenceList
import
unittest
from
testVifibSlapWebService
import
TestVifibSlapWebServiceMixin
from
slapos
import
slap
import
random
class
TestVifibSlapBug
(
TestVifibSlapWebServiceMixin
):
def
test_bug_Person_request_more_then_one_instance
(
self
):
...
...
@@ -1076,6 +1078,53 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
stepSetRequestedStateStarted
(
self
,
sequence
,
**
kw
):
sequence
[
'state'
]
=
'started'
def
stepSetRequestedReferenceRandom
(
self
,
sequence
,
**
kw
):
sequence
[
'requested_reference'
]
=
str
(
random
.
random
())
def
test_request_start_non_instantiated_partition
(
self
):
"""Prove that requesting start of non instantiated partition will not
result in any error"""
self
.
computer_partition_amount
=
0
sequence_list
=
SequenceList
()
sequence_string
=
self
.
prepare_published_software_release
+
\
self
.
prepare_formated_computer
+
"""
LoginTestVifibAdmin
RequestSoftwareInstallation
Tic
Logout
SlapLoginCurrentComputer
ComputerSoftwareReleaseAvailable
Tic
SlapLogout
SlapLoginTestVifibCustomer
SetRequestedStateStarted
SetRequestedReferenceRandom
PersonRequestSlapSoftwareInstance
Tic
SlapLogout
LoginDefaultUser
SetCurrentPersonSlapRequestedSoftwareInstance
SoftwareInstanceSaleOrderConfirmRaisesValueError
Logout
SlapLoginTestVifibCustomer
PersonRequestSlapSoftwareInstance
Tic
SlapLogout
LoginDefaultUser
SoftwareInstanceSaleOrderConfirmRaisesValueError
Logout
"""
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestVifibSlapBug
))
...
...
master/product/Vifib/tests/testVifibSlapOpenOrderRequest.py
View file @
acff838f
...
...
@@ -21,59 +21,10 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
partition_reference
=
sequence
.
get
(
'requested_reference'
,
'requested_reference'
),
partition_parameter_kw
=
sequence
.
get
(
'requested_parameter_dict'
,
{}),
filter_kw
=
sequence
.
get
(
'requested_filter_dict'
,
{})
filter_kw
=
sequence
.
get
(
'requested_filter_dict'
,
{}),
state
=
sequence
.
get
(
'requested_state'
)
)
def
stepPersonRequestSlapSoftwareInstance
(
self
,
sequence
,
**
kw
):
software_release
=
sequence
[
'software_release_uri'
]
self
.
slap
=
slap
.
slap
()
self
.
slap
.
initializeConnection
(
self
.
server_url
,
timeout
=
None
)
open_order
=
self
.
slap
.
registerOpenOrder
()
requested_slap_computer_partition
=
open_order
.
request
(
software_release
=
software_release
,
software_type
=
sequence
.
get
(
'software_type'
,
'software_type'
),
partition_reference
=
sequence
[
'requested_reference'
],
partition_parameter_kw
=
sequence
.
get
(
'requested_parameter_dict'
,
{}),
filter_kw
=
sequence
.
get
(
'requested_filter_dict'
,
{}))
sequence
.
edit
(
requested_slap_computer_partition
=
requested_slap_computer_partition
,
requested_computer_partition_reference
=
\
requested_slap_computer_partition
.
getId
())
def
stepSetCurrentPersonSlapRequestedSoftwareInstance
(
self
,
sequence
,
**
kw
):
software_instance_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
self
.
software_instance_portal_type
,
title
=
sequence
[
'requested_reference'
])
self
.
assertEqual
(
1
,
len
(
software_instance_list
))
software_instance
=
software_instance_list
[
0
]
sequence
.
edit
(
software_instance_uid
=
software_instance
.
getUid
(),
software_instance_reference
=
software_instance
.
getReference
(),
hosting_subscription_uid
=
software_instance
.
getAggregateRelatedValue
(
portal_type
=
'Sale Order Line'
).
getAggregateValue
(
portal_type
=
'Hosting Subscription'
).
getUid
())
def
stepSoftwareInstanceSaleOrderConfirmRaisesValueError
(
self
,
sequence
,
**
kw
):
"""Checks that current software instance is realted only with sale order
and that this sale order cannot be confirmed
In Vifib implementation sale order which cannot find free computer partition
raises ValueError"""
software_instance
=
self
.
portal
.
portal_catalog
.
getResultValue
(
uid
=
sequence
[
'software_instance_uid'
])
aggregate_value_list
=
software_instance
.
getAggregateRelatedValueList
(
portal_type
=
[
self
.
sale_packing_list_line_portal_type
,
self
.
sale_order_line_portal_type
])
self
.
assertEqual
(
1
,
len
(
aggregate_value_list
))
self
.
assertTrue
(
self
.
sale_order_line_portal_type
in
[
q
.
getPortalType
()
for
\
q
in
aggregate_value_list
])
sale_order_line
=
aggregate_value_list
[
0
]
sale_order
=
sale_order_line
.
getParentValue
()
self
.
assertRaises
(
ValueError
,
sale_order
.
confirm
)
def
test_person_request_ComputerPartition_filter_computer_guid
(
self
):
"""Check that requesting with computer_guid in filter_kw works as
expected in case of person request"""
...
...
master/product/Vifib/tests/testVifibSlapWebService.py
View file @
acff838f
...
...
@@ -178,6 +178,60 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
########################################
# Steps -- scenarios
########################################
def
stepPersonRequestSlapSoftwareInstance
(
self
,
sequence
,
**
kw
):
software_release
=
sequence
[
'software_release_uri'
]
self
.
slap
=
slap
.
slap
()
self
.
slap
.
initializeConnection
(
self
.
server_url
,
timeout
=
None
)
open_order
=
self
.
slap
.
registerOpenOrder
()
requested_slap_computer_partition
=
open_order
.
request
(
software_release
=
software_release
,
software_type
=
sequence
.
get
(
'software_type'
,
'software_type'
),
partition_reference
=
sequence
.
get
(
'requested_reference'
,
'requested_reference'
),
partition_parameter_kw
=
sequence
.
get
(
'requested_parameter_dict'
,
{}),
filter_kw
=
sequence
.
get
(
'requested_filter_dict'
,
{}),
state
=
sequence
.
get
(
'requested_state'
))
sequence
.
edit
(
requested_slap_computer_partition
=
requested_slap_computer_partition
,
requested_computer_partition_reference
=
\
requested_slap_computer_partition
.
getId
())
def
stepSetCurrentPersonSlapRequestedSoftwareInstance
(
self
,
sequence
,
**
kw
):
software_instance_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
self
.
software_instance_portal_type
,
title
=
sequence
[
'requested_reference'
])
self
.
assertEqual
(
1
,
len
(
software_instance_list
))
software_instance
=
software_instance_list
[
0
]
sequence
.
edit
(
software_instance_uid
=
software_instance
.
getUid
(),
software_instance_reference
=
software_instance
.
getReference
(),
hosting_subscription_uid
=
software_instance
.
getAggregateRelatedValue
(
portal_type
=
'Sale Order Line'
).
getAggregateValue
(
portal_type
=
'Hosting Subscription'
).
getUid
())
def
stepSoftwareInstanceSaleOrderConfirmRaisesValueError
(
self
,
sequence
,
**
kw
):
"""Checks that current software instance is realted only with sale order
and that this sale order cannot be confirmed
In Vifib implementation sale order which cannot find free computer partition
raises ValueError"""
software_instance
=
self
.
portal
.
portal_catalog
.
getResultValue
(
uid
=
sequence
[
'software_instance_uid'
])
aggregate_value_list
=
software_instance
.
getAggregateRelatedValueList
(
portal_type
=
[
self
.
sale_packing_list_line_portal_type
,
self
.
sale_order_line_portal_type
])
self
.
assertEqual
(
1
,
len
(
aggregate_value_list
))
self
.
assertTrue
(
self
.
sale_order_line_portal_type
in
[
q
.
getPortalType
()
for
\
q
in
aggregate_value_list
])
sale_order_line
=
aggregate_value_list
[
0
]
sale_order
=
sale_order_line
.
getParentValue
()
self
.
assertRaises
(
ValueError
,
sale_order
.
confirm
)
def
stepCheckViewCurrentSoftwareInstance
(
self
,
sequence
,
**
kw
):
software_instance
=
self
.
portal
.
portal_catalog
.
getResultValue
(
uid
=
sequence
[
'software_instance_uid'
])
...
...
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