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
Thomas Leymonerie
slapos.core
Commits
435601a6
Commit
435601a6
authored
Oct 24, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep8ized.
parent
4dced9de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
56 deletions
+56
-56
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCoreSoftwareInstanceRequest.py
...TestTemplateItem/testSlapOSCoreSoftwareInstanceRequest.py
+55
-55
master/bt5/slapos_cloud/bt/revision
master/bt5/slapos_cloud/bt/revision
+1
-1
No files found.
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCoreSoftwareInstanceRequest.py
View file @
435601a6
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from
Products.SlapOS.tests.testSlapOSMixin
import
\
testSlapOSMixin
testSlapOSMixin
import
transaction
from
Products.ERP5Type.tests.backportUnittest
import
expectedFailure
class
TestSlapOSCoreSoftwareInstanceRequest
(
testSlapOSMixin
):
def
generateNewId
(
self
):
return
self
.
getPortalObject
().
portal_ids
.
generateNewId
(
id_group
=
(
'slapos_core_test'
))
id_group
=
(
'slapos_core_test'
))
def
generateNewSoftwareReleaseUrl
(
self
):
return
'http://example.org/test%s.cfg'
%
self
.
generateNewId
()
...
...
@@ -42,7 +43,6 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
self
.
software_instance
=
portal
.
software_instance_module
\
.
template_software_instance
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
.
edit
(
title
=
self
.
request_kw
[
'software_title'
],
reference
=
"TESTHS-%s"
%
new_id
,
...
...
@@ -90,37 +90,37 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'software_release'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
**
request_kw
)
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'software_title'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
**
request_kw
)
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'software_type'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
**
request_kw
)
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'instance_xml'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
**
request_kw
)
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'sla_xml'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
**
request_kw
)
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'shared'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
**
request_kw
)
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'state'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
**
request_kw
)
def
test_request_createdInstance
(
self
):
request_kw
=
self
.
request_kw
.
copy
()
...
...
@@ -135,26 +135,26 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
self
.
assertNotEqual
(
None
,
requested_instance
)
self
.
assertEqual
(
request_kw
[
'software_title'
],
requested_instance
.
getTitle
())
requested_instance
.
getTitle
())
self
.
assertEqual
(
'Software Instance'
,
requested_instance
.
getPortalType
())
requested_instance
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
requested_instance
.
getValidationState
())
requested_instance
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
requested_instance
.
getSlapState
())
requested_instance
.
getSlapState
())
self
.
assertEqual
(
request_kw
[
'software_release'
],
requested_instance
.
getRootSoftwareReleaseUrl
())
requested_instance
.
getRootSoftwareReleaseUrl
())
self
.
assertEqual
(
request_kw
[
'instance_xml'
],
requested_instance
.
getTextContent
())
requested_instance
.
getTextContent
())
self
.
assertEqual
(
request_kw
[
'sla_xml'
],
requested_instance
.
getSlaXml
())
requested_instance
.
getSlaXml
())
self
.
assertEqual
(
request_kw
[
'software_type'
],
requested_instance
.
getSourceReference
())
requested_instance
.
getSourceReference
())
def
test_request_sameTitle
(
self
):
# check that correct request does not raise
self
.
assertRaises
(
ValueError
,
self
.
software_instance
.
requestInstance
,
**
self
.
request_kw
)
**
self
.
request_kw
)
def
test_request_shared_True
(
self
):
request_kw
=
self
.
request_kw
.
copy
()
...
...
@@ -170,21 +170,21 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
self
.
assertNotEqual
(
None
,
requested_instance
)
self
.
assertEqual
(
request_kw
[
'software_title'
],
requested_instance
.
getTitle
())
requested_instance
.
getTitle
())
self
.
assertEqual
(
'Slave Instance'
,
requested_instance
.
getPortalType
())
requested_instance
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
requested_instance
.
getValidationState
())
requested_instance
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
requested_instance
.
getSlapState
())
requested_instance
.
getSlapState
())
self
.
assertEqual
(
request_kw
[
'software_release'
],
requested_instance
.
getRootSoftwareReleaseUrl
())
requested_instance
.
getRootSoftwareReleaseUrl
())
self
.
assertEqual
(
request_kw
[
'instance_xml'
],
requested_instance
.
getTextContent
())
requested_instance
.
getTextContent
())
self
.
assertEqual
(
request_kw
[
'sla_xml'
],
requested_instance
.
getSlaXml
())
requested_instance
.
getSlaXml
())
self
.
assertEqual
(
request_kw
[
'software_type'
],
requested_instance
.
getSourceReference
())
requested_instance
.
getSourceReference
())
def
test_request_shared_unsupported
(
self
):
request_kw
=
self
.
request_kw
.
copy
()
...
...
@@ -193,7 +193,7 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
request_kw
[
'shared'
]
=
'True'
self
.
assertRaises
(
ValueError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
**
request_kw
)
def
test_request_unindexed
(
self
):
request_kw
=
self
.
request_kw
.
copy
()
...
...
@@ -305,14 +305,14 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
duplicate2
.
validate
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
duplicate2
,
'start_requested'
)
self
.
software_instance
.
getSpecialiseValue
(
\
portal_type
=
'Hosting Subscription'
).
edit
(
predecessor_list
=
[
duplicate
.
getRelativeUrl
(),
duplicate2
.
getRelativeUrl
(),
self
.
software_instance
.
getRelativeUrl
()
]
)
self
.
software_instance
.
getSpecialiseValue
(
portal_type
=
'Hosting Subscription'
).
edit
(
predecessor_list
=
[
duplicate
.
getRelativeUrl
(),
duplicate2
.
getRelativeUrl
(),
self
.
software_instance
.
getRelativeUrl
()
]
)
self
.
tic
()
self
.
assertRaises
(
ValueError
,
self
.
software_instance
.
requestInstance
,
...
...
@@ -355,22 +355,23 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
requested_instance2
.
getRelativeUrl
())
self
.
assertSameSet
(
self
.
software_instance
.
getPredecessorList
(),
[
requested_instance
.
getRelativeUrl
(),
requested_instance2
.
getRelativeUrl
()])
self
.
software_instance
.
getPredecessorList
(),
[
requested_instance
.
getRelativeUrl
(),
requested_instance2
.
getRelativeUrl
()])
def
test_request_tree_change_indexed
(
self
):
"""Checks tree change forced by request
For a tree like:
A
|
A
|
\
B C
When B requests C tree shall change to:
A
|
A
...
...
@@ -389,8 +390,8 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
C_instance
=
self
.
software_instance
.
REQUEST
.
get
(
'request_instance'
)
self
.
assertSameSet
(
self
.
software_instance
.
getPredecessorList
(),
[
B_instance
.
getRelativeUrl
(),
C_instance
.
getRelativeUrl
()])
self
.
software_instance
.
getPredecessorList
(),
[
B_instance
.
getRelativeUrl
(),
C_instance
.
getRelativeUrl
()])
self
.
tic
()
# in order to recalculate tree
...
...
@@ -406,15 +407,15 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
def
test_request_tree_change_not_indexed
(
self
):
"""Checks tree change forced by request
For a tree like:
A
|
A
|
\
B C
When B requests C tree in next transaction, but before indexation,
the system shall disallow the operation."""
request_kw
=
self
.
request_kw
.
copy
()
...
...
@@ -428,8 +429,8 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
C_instance
=
self
.
software_instance
.
REQUEST
.
get
(
'request_instance'
)
self
.
assertSameSet
(
self
.
software_instance
.
getPredecessorList
(),
[
B_instance
.
getRelativeUrl
(),
C_instance
.
getRelativeUrl
()])
self
.
software_instance
.
getPredecessorList
(),
[
B_instance
.
getRelativeUrl
(),
C_instance
.
getRelativeUrl
()])
transaction
.
commit
()
...
...
@@ -439,15 +440,15 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
@
expectedFailure
def
test_request_tree_change_same_transaction
(
self
):
"""Checks tree change forced by request
For a tree like:
A
|
A
|
\
B C
When B requests C tree in the same transaction the system shall
disallow the operation."""
request_kw
=
self
.
request_kw
.
copy
()
...
...
@@ -461,8 +462,8 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
C_instance
=
self
.
software_instance
.
REQUEST
.
get
(
'request_instance'
)
self
.
assertSameSet
(
self
.
software_instance
.
getPredecessorList
(),
[
B_instance
.
getRelativeUrl
(),
C_instance
.
getRelativeUrl
()])
self
.
software_instance
.
getPredecessorList
(),
[
B_instance
.
getRelativeUrl
(),
C_instance
.
getRelativeUrl
()])
self
.
assertRaises
(
NotImplementedError
,
B_instance
.
requestInstance
,
**
request_kw
)
...
...
@@ -521,7 +522,6 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
self
.
assertEqual
(
request_kw
[
'software_type'
],
requested_instance2
.
getSourceReference
())
self
.
tic
()
request_kw
[
'state'
]
=
'destroyed'
...
...
master/bt5/slapos_cloud/bt/revision
View file @
435601a6
73
\ No newline at end of file
74
\ No newline at end of file
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