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
Ophélie Gagnard
slapos.core
Commits
277a7592
Commit
277a7592
authored
Oct 23, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initialise TestSlapOSCoreSoftwareInstanceRequest
parent
beadbf66
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
173 additions
and
8 deletions
+173
-8
master/bt5/slapos_cloud/PathTemplateItem/hosting_subscription_module/template_hosting_subscription.xml
...ing_subscription_module/template_hosting_subscription.xml
+25
-3
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCoreSoftwareInstanceRequest.py
...TestTemplateItem/testSlapOSCoreSoftwareInstanceRequest.py
+141
-0
master/bt5/slapos_cloud/bt/revision
master/bt5/slapos_cloud/bt/revision
+1
-1
master/bt5/slapos_cloud/bt/template_path_list
master/bt5/slapos_cloud/bt/template_path_list
+2
-0
master/bt5/slapos_cloud/bt/template_test_id_list
master/bt5/slapos_cloud/bt/template_test_id_list
+3
-2
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
+1
-1
master/bt5/vifib_slapos_rest_api_v1_test/bt/template_path_list
...r/bt5/vifib_slapos_rest_api_v1_test/bt/template_path_list
+0
-1
No files found.
master/bt5/
vifib_slapos_rest_api_v1_test
/PathTemplateItem/hosting_subscription_module/template_hosting_subscription.xml
→
master/bt5/
slapos_cloud
/PathTemplateItem/hosting_subscription_module/template_hosting_subscription.xml
View file @
277a7592
...
...
@@ -76,9 +76,7 @@
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
predecessor/software_instance_module/template_software_instance
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -107,6 +105,30 @@
<none/>
</value>
</item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
<value>
<tuple>
<int>
0
</int>
</tuple>
</value>
</item>
<item>
<key>
<string>
periodicity_minute
</string>
</key>
<value>
<tuple>
<int>
0
</int>
</tuple>
</value>
</item>
<item>
<key>
<string>
periodicity_month_day
</string>
</key>
<value>
<tuple>
<int>
23
</int>
</tuple>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Hosting Subscription
</string>
</value>
...
...
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCoreSoftwareInstanceRequest.py
0 → 100644
View file @
277a7592
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from
Products.SlapOS.tests.testSlapOSMixin
import
\
testSlapOSMixin
import
transaction
class
TestSlapOSCoreSoftwareInstanceRequest
(
testSlapOSMixin
):
def
generateNewId
(
self
):
return
self
.
getPortalObject
().
portal_ids
.
generateNewId
(
id_group
=
(
'slapos_core_test'
))
def
generateNewSoftwareReleaseUrl
(
self
):
return
'http://example.org/test%s.cfg'
%
self
.
generateNewId
()
def
generateNewSoftwareType
(
self
):
return
'Type%s'
%
self
.
generateNewId
()
def
generateNewSoftwareTitle
(
self
):
return
'Title%s'
%
self
.
generateNewId
()
def
afterSetUp
(
self
):
portal
=
self
.
getPortalObject
()
new_id
=
self
.
generateNewId
()
self
.
setupPortalCertificateAuthority
()
safe_xml
=
'<?xml version="1.0" encoding="utf-8"?><instance></instance>'
title
=
self
.
generateNewSoftwareTitle
()
self
.
request_kw
=
dict
(
software_release
=
self
.
generateNewSoftwareReleaseUrl
(),
software_title
=
title
,
software_type
=
self
.
generateNewSoftwareType
(),
instance_xml
=
safe_xml
,
sla_xml
=
safe_xml
,
shared
=
False
,
state
=
"started"
)
# prepare part of tree
hosting_subscription
=
portal
.
hosting_subscription_module
\
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
.
edit
(
title
=
title
,
reference
=
"TESTHS-%s"
%
new_id
)
hosting_subscription
.
updateLocalRolesOnSecurityGroups
()
hosting_subscription
.
validate
()
hosting_subscription
.
requestStart
(
**
self
.
request_kw
)
hosting_subscription
.
requestInstance
(
**
self
.
request_kw
)
self
.
software_instance
=
hosting_subscription
.
getPredecessorValue
(
portal_type
=
'Software Instance'
)
self
.
tic
()
# XXX: NOT FOR COMMIT
hosting_subscription
.
__ac_local_roles__
[
self
.
software_instance
.
getReference
()]
=
[
'Assignor'
]
self
.
software_instance
.
__ac_local_roles__
[
self
.
software_instance
.
getReference
()]
=
[
'Assignor'
]
transaction
.
commit
()
hosting_subscription
.
recursiveImmediateReindexObject
()
self
.
software_instance
.
recursiveImmediateReindexObject
()
# XXX: /NOT FOR COMMIT
# Login as new Software Instance
self
.
login
(
self
.
software_instance
.
getReference
())
def
beforeTearDown
(
self
):
pass
def
test_request_requiredParameter
(
self
):
good_request_kw
=
self
.
request_kw
.
copy
()
# in order to have unique requested title
good_request_kw
[
'software_title'
]
=
self
.
generateNewSoftwareTitle
()
# check that correct request does not raise
self
.
software_instance
.
requestInstance
(
**
good_request_kw
)
# substract parameters
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'software_release'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'software_title'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'software_type'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'instance_xml'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'sla_xml'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'shared'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
request_kw
=
good_request_kw
.
copy
()
request_kw
.
pop
(
'state'
)
self
.
assertRaises
(
KeyError
,
self
.
software_instance
.
requestInstance
,
**
request_kw
)
def
test_request_createdInstance
(
self
):
request_kw
=
self
.
request_kw
.
copy
()
# in order to have unique requested title
request_kw
[
'software_title'
]
=
self
.
generateNewSoftwareTitle
()
# check that correct request does not raise
self
.
software_instance
.
requestInstance
(
**
request_kw
)
requested_instance
=
self
.
software_instance
.
REQUEST
.
get
(
'request_instance'
)
self
.
assertNotEqual
(
None
,
requested_instance
)
self
.
assertEqual
(
request_kw
[
'software_title'
],
requested_instance
.
getTitle
())
self
.
assertEqual
(
'Software Instance'
,
requested_instance
.
getPortalType
())
self
.
assertEqual
(
'validated'
,
requested_instance
.
getValidationState
())
self
.
assertEqual
(
'start_requested'
,
requested_instance
.
getSlapState
())
self
.
assertEqual
(
request_kw
[
'software_release'
],
requested_instance
.
getRootSoftwareReleaseUrl
())
self
.
assertEqual
(
request_kw
[
'instance_xml'
],
requested_instance
.
getTextContent
())
self
.
assertEqual
(
request_kw
[
'sla_xml'
],
requested_instance
.
getSlaXml
())
self
.
assertEqual
(
request_kw
[
'software_type'
],
requested_instance
.
getSourceReference
())
master/bt5/slapos_cloud/bt/revision
View file @
277a7592
68
\ No newline at end of file
69
\ No newline at end of file
master/bt5/slapos_cloud/bt/template_path_list
View file @
277a7592
acl_users/slapos_shadow
computer_module/template_computer
computer_module/template_computer/**
hosting_subscription_module/template_hosting_subscription
person_module/template_member
person_module/template_member/**
\ No newline at end of file
master/bt5/slapos_cloud/bt/template_test_id_list
View file @
277a7592
testSlapOS
Shadow
testSlapOS
CorePersonComputerSupply
testSlapOSCorePersonRequest
testSlapOSCorePersonRequestComputer
testSlapOSCorePersonComputerSupply
\ No newline at end of file
testSlapOSCoreSoftwareInstanceRequest
testSlapOSShadow
\ No newline at end of file
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
View file @
277a7592
83
\ No newline at end of file
84
\ No newline at end of file
master/bt5/vifib_slapos_rest_api_v1_test/bt/template_path_list
View file @
277a7592
hosting_subscription_module/template_hosting_subscription
software_instance_module/template_software_instance
\ 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