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
Guillaume Hervier
slapos.core
Commits
a6b94ad4
Commit
a6b94ad4
authored
Oct 31, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge to avoid further duplication.
parent
ab3cee7d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
320 additions
and
325 deletions
+320
-325
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCoreComputerSlapInterfaceWorkflow.py
...mplateItem/testSlapOSCoreComputerSlapInterfaceWorkflow.py
+319
-0
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCorePersonComputerSupply.py
...ud/TestTemplateItem/testSlapOSCorePersonComputerSupply.py
+0
-323
master/bt5/slapos_cloud/bt/revision
master/bt5/slapos_cloud/bt/revision
+1
-1
master/bt5/slapos_cloud/bt/template_test_id_list
master/bt5/slapos_cloud/bt/template_test_id_list
+0
-1
No files found.
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCoreComputerSlapInterfaceWorkflow.py
View file @
a6b94ad4
...
...
@@ -3,6 +3,7 @@ from Products.SlapOS.tests.testSlapOSMixin import \
testSlapOSMixin
import
transaction
from
Products.ERP5Type.tests.backportUnittest
import
expectedFailure
from
Products.ERP5Type.Errors
import
UnsupportedWorkflowMethod
class
TestSlapOSCoreComputerSlapInterfaceWorkflow
(
testSlapOSMixin
):
def
afterSetUp
(
self
):
...
...
@@ -286,3 +287,321 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
self
.
assertEqual
(
None
,
self
.
portal
.
REQUEST
.
get
(
'computer_key'
))
self
.
assertEqual
(
None
,
self
.
portal
.
REQUEST
.
get
(
'computer_certificate'
))
self
.
assertEqual
(
None
,
self
.
computer
.
getDestinationReference
())
class
TestSlapOSCorePersonComputerSupply
(
testSlapOSMixin
):
def
afterSetUp
(
self
):
super
(
TestSlapOSCorePersonComputerSupply
,
self
).
afterSetUp
()
portal
=
self
.
getPortalObject
()
new_id
=
self
.
generateNewId
()
# Clone computer document
computer
=
portal
.
computer_module
.
template_computer
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
# Clone person document
person_user
=
portal
.
person_module
.
template_member
.
\
Base_createCloneDocument
(
batch_mode
=
1
)
person_user
.
edit
(
title
=
"live_test_%s"
%
new_id
,
reference
=
"live_test_%s"
%
new_id
,
default_email_text
=
"live_test_%s@example.org"
%
new_id
,
)
computer
.
edit
(
title
=
"Computer %s for %s"
%
(
new_id
,
person_user
.
getReference
()),
reference
=
"TESTCOMP-%s"
%
new_id
,
source_administration
=
person_user
.
getRelativeUrl
()
)
computer
.
validate
()
self
.
computer
=
computer
person_user
.
validate
()
for
assignment
in
person_user
.
contentValues
(
portal_type
=
"Assignment"
):
assignment
.
open
()
transaction
.
commit
()
# XXX Tic is needed to reindex the created open order
self
.
tic
()
# Login as new user
self
.
login
(
person_user
.
getReference
())
new_person
=
self
.
getPortalObject
().
ERP5Site_getAuthenticatedMemberPersonValue
()
self
.
assertEquals
(
person_user
.
getRelativeUrl
(),
new_person
.
getRelativeUrl
())
def
beforeTearDown
(
self
):
if
'software_installation_url'
in
self
.
computer
.
REQUEST
:
self
.
computer
.
REQUEST
[
'software_installation_url'
]
=
None
def
test_supply_requiredParameter
(
self
):
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
assertRaises
(
TypeError
,
self
.
computer
.
requestSoftwareRelease
)
self
.
assertRaises
(
TypeError
,
self
.
computer
.
requestSoftwareRelease
,
state
=
"available"
)
self
.
assertRaises
(
TypeError
,
self
.
computer
.
requestSoftwareRelease
,
software_release_url
=
software_release
)
self
.
assertRaises
(
ValueError
,
self
.
computer
.
requestSoftwareRelease
,
state
=
"mana"
,
software_release_url
=
software_release
)
def
test_supply_available
(
self
):
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
def
test_supply_destroyed
(
self
):
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"destroyed"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertEqual
(
None
,
software_installation_url
)
def
test_supply_available_nonIndexed
(
self
):
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
transaction
.
commit
()
self
.
assertRaises
(
NotImplementedError
,
self
.
computer
.
requestSoftwareRelease
,
state
=
"available"
,
software_release_url
=
software_release
)
def
test_supply_available_destroyed_nonIndexed
(
self
):
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
transaction
.
commit
()
self
.
assertRaises
(
NotImplementedError
,
self
.
computer
.
requestSoftwareRelease
,
state
=
"destroyed"
,
software_release_url
=
software_release
)
def
test_supply_available_createdSoftwareInstallation
(
self
):
previous_id
=
self
.
getPortalObject
().
portal_ids
\
.
generateNewId
(
id_group
=
'slap_software_installation_reference'
,
id_generator
=
'uid'
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
def
test_multiple_supply_available_createdSoftwareInstallation
(
self
):
previous_id
=
self
.
getPortalObject
().
portal_ids
\
.
generateNewId
(
id_group
=
'slap_software_installation_reference'
,
id_generator
=
'uid'
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
self
.
tic
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url2
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertEqual
(
software_installation_url
,
software_installation_url2
)
def
test_supply_available_destroyed
(
self
):
previous_id
=
self
.
getPortalObject
().
portal_ids
\
.
generateNewId
(
id_group
=
'slap_software_installation_reference'
,
id_generator
=
'uid'
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
self
.
tic
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"destroyed"
,
software_release_url
=
software_release
)
software_installation_url2
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertEqual
(
software_installation_url
,
software_installation_url2
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url2
)
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'destroy_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
def
test_supply_available_destroyed_available
(
self
):
previous_id
=
self
.
getPortalObject
().
portal_ids
\
.
generateNewId
(
id_group
=
'slap_software_installation_reference'
,
id_generator
=
'uid'
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
self
.
tic
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"destroyed"
,
software_release_url
=
software_release
)
software_installation_url2
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertEqual
(
software_installation_url
,
software_installation_url2
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url2
)
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'destroy_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
self
.
tic
()
# XXX: This scenario shall be discussed...
self
.
assertRaises
(
UnsupportedWorkflowMethod
,
self
.
computer
.
requestSoftwareRelease
,
state
=
"available"
,
software_release_url
=
software_release
)
def
test_supply_available_destroyed_finalised_available
(
self
):
previous_id
=
self
.
getPortalObject
().
portal_ids
\
.
generateNewId
(
id_group
=
'slap_software_installation_reference'
,
id_generator
=
'uid'
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
self
.
tic
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"destroyed"
,
software_release_url
=
software_release
)
software_installation_url2
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertEqual
(
software_installation_url
,
software_installation_url2
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url2
)
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'destroy_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
software_installation
.
invalidate
()
self
.
tic
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url3
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
software_installation_url
,
software_installation_url3
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url3
)
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
2
),
software_installation
.
getReference
())
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCorePersonComputerSupply.py
deleted
100644 → 0
View file @
ab3cee7d
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from
Products.SlapOS.tests.testSlapOSMixin
import
\
testSlapOSMixin
import
transaction
from
Products.ERP5Type.Errors
import
UnsupportedWorkflowMethod
class
TestSlapOSCorePersonComputerSupply
(
testSlapOSMixin
):
def
afterSetUp
(
self
):
super
(
TestSlapOSCorePersonComputerSupply
,
self
).
afterSetUp
()
portal
=
self
.
getPortalObject
()
new_id
=
self
.
generateNewId
()
# Clone computer document
computer
=
portal
.
computer_module
.
template_computer
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
# Clone person document
person_user
=
portal
.
person_module
.
template_member
.
\
Base_createCloneDocument
(
batch_mode
=
1
)
person_user
.
edit
(
title
=
"live_test_%s"
%
new_id
,
reference
=
"live_test_%s"
%
new_id
,
default_email_text
=
"live_test_%s@example.org"
%
new_id
,
)
computer
.
edit
(
title
=
"Computer %s for %s"
%
(
new_id
,
person_user
.
getReference
()),
reference
=
"TESTCOMP-%s"
%
new_id
,
source_administration
=
person_user
.
getRelativeUrl
()
)
computer
.
validate
()
self
.
computer
=
computer
person_user
.
validate
()
for
assignment
in
person_user
.
contentValues
(
portal_type
=
"Assignment"
):
assignment
.
open
()
transaction
.
commit
()
# XXX Tic is needed to reindex the created open order
self
.
tic
()
# Login as new user
self
.
login
(
person_user
.
getReference
())
new_person
=
self
.
getPortalObject
().
ERP5Site_getAuthenticatedMemberPersonValue
()
self
.
assertEquals
(
person_user
.
getRelativeUrl
(),
new_person
.
getRelativeUrl
())
def
beforeTearDown
(
self
):
if
'software_installation_url'
in
self
.
computer
.
REQUEST
:
self
.
computer
.
REQUEST
[
'software_installation_url'
]
=
None
def
test_supply_requiredParameter
(
self
):
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
assertRaises
(
TypeError
,
self
.
computer
.
requestSoftwareRelease
)
self
.
assertRaises
(
TypeError
,
self
.
computer
.
requestSoftwareRelease
,
state
=
"available"
)
self
.
assertRaises
(
TypeError
,
self
.
computer
.
requestSoftwareRelease
,
software_release_url
=
software_release
)
self
.
assertRaises
(
ValueError
,
self
.
computer
.
requestSoftwareRelease
,
state
=
"mana"
,
software_release_url
=
software_release
)
def
test_supply_available
(
self
):
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
def
test_supply_destroyed
(
self
):
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"destroyed"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertEqual
(
None
,
software_installation_url
)
def
test_supply_available_nonIndexed
(
self
):
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
transaction
.
commit
()
self
.
assertRaises
(
NotImplementedError
,
self
.
computer
.
requestSoftwareRelease
,
state
=
"available"
,
software_release_url
=
software_release
)
def
test_supply_available_destroyed_nonIndexed
(
self
):
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
transaction
.
commit
()
self
.
assertRaises
(
NotImplementedError
,
self
.
computer
.
requestSoftwareRelease
,
state
=
"destroyed"
,
software_release_url
=
software_release
)
def
test_supply_available_createdSoftwareInstallation
(
self
):
previous_id
=
self
.
getPortalObject
().
portal_ids
\
.
generateNewId
(
id_group
=
'slap_software_installation_reference'
,
id_generator
=
'uid'
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
def
test_multiple_supply_available_createdSoftwareInstallation
(
self
):
previous_id
=
self
.
getPortalObject
().
portal_ids
\
.
generateNewId
(
id_group
=
'slap_software_installation_reference'
,
id_generator
=
'uid'
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
self
.
tic
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url2
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertEqual
(
software_installation_url
,
software_installation_url2
)
def
test_supply_available_destroyed
(
self
):
previous_id
=
self
.
getPortalObject
().
portal_ids
\
.
generateNewId
(
id_group
=
'slap_software_installation_reference'
,
id_generator
=
'uid'
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
self
.
tic
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"destroyed"
,
software_release_url
=
software_release
)
software_installation_url2
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertEqual
(
software_installation_url
,
software_installation_url2
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url2
)
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'destroy_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
def
test_supply_available_destroyed_available
(
self
):
previous_id
=
self
.
getPortalObject
().
portal_ids
\
.
generateNewId
(
id_group
=
'slap_software_installation_reference'
,
id_generator
=
'uid'
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
self
.
tic
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"destroyed"
,
software_release_url
=
software_release
)
software_installation_url2
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertEqual
(
software_installation_url
,
software_installation_url2
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url2
)
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'destroy_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
self
.
tic
()
# XXX: This scenario shall be discussed...
self
.
assertRaises
(
UnsupportedWorkflowMethod
,
self
.
computer
.
requestSoftwareRelease
,
state
=
"available"
,
software_release_url
=
software_release
)
def
test_supply_available_destroyed_finalised_available
(
self
):
previous_id
=
self
.
getPortalObject
().
portal_ids
\
.
generateNewId
(
id_group
=
'slap_software_installation_reference'
,
id_generator
=
'uid'
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
None
,
software_installation_url
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url
)
self
.
assertEqual
(
software_release
,
software_installation
.
getUrlString
())
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
self
.
tic
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"destroyed"
,
software_release_url
=
software_release
)
software_installation_url2
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertEqual
(
software_installation_url
,
software_installation_url2
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url2
)
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'destroy_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
1
),
software_installation
.
getReference
())
software_installation
.
invalidate
()
self
.
tic
()
self
.
computer
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_installation_url3
=
self
.
computer
.
REQUEST
.
get
(
'software_installation_url'
)
self
.
assertNotEqual
(
software_installation_url
,
software_installation_url3
)
software_installation
=
self
.
computer
.
restrictedTraverse
(
software_installation_url3
)
self
.
assertEqual
(
'Software Installation'
,
software_installation
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
'SOFTINSTALL-%s'
%
(
previous_id
+
2
),
software_installation
.
getReference
())
master/bt5/slapos_cloud/bt/revision
View file @
a6b94ad4
178
\ No newline at end of file
179
\ No newline at end of file
master/bt5/slapos_cloud/bt/template_test_id_list
View file @
a6b94ad4
testSlapOSCorePersonComputerSupply
testSlapOSShadow
testSlapOSCoreAllocation
testSlapOSCoreComputerSlapInterfaceWorkflow
...
...
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