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
65cb6a3f
Commit
65cb6a3f
authored
May 04, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Covert software instance GET and certificate fetching.
parent
feb06320
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
566 additions
and
2 deletions
+566
-2
master/bt5/vifib_slapos_rest_api_v1_test/PathTemplateItem/hosting_subscription_module/template_hosting_subscription.xml
...ing_subscription_module/template_hosting_subscription.xml
+153
-0
master/bt5/vifib_slapos_rest_api_v1_test/PathTemplateItem/software_instance_module/template_software_instance.xml
...m/software_instance_module/template_software_instance.xml
+260
-0
master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
..._api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
+150
-1
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
+2
-0
No files found.
master/bt5/vifib_slapos_rest_api_v1_test/PathTemplateItem/hosting_subscription_module/template_hosting_subscription.xml
0 → 100644
View file @
65cb6a3f
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Hosting Subscription"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Access_contents_information_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Author
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Add_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Author
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Delete_objects_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Author
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Modify_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Author
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_View_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Author
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
predecessor/software_instance_module/template_software_instance
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
RootSoftwareInstance
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
template_hosting_subscription
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Hosting Subscription
</string>
</value>
</item>
<item>
<key>
<string>
root_slave
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
root_software_release_url
</string>
</key>
<value>
<string>
http://example.com/root/software/release
</string>
</value>
</item>
<item>
<key>
<string>
sla_xml
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<?xml version=\'1.0\' encoding=\'utf-8\'?>
\n
<instance>
\n
<parameter
id=
"computer_guid"
>
SOMECOMP
</parameter>
\n
</instance>
\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
text_content
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<?xml version="1.0" encoding="utf-8"?>
\n
<instance>
\n
<parameter
id=
"parameter1"
>
valueof1
</parameter>
\n
<parameter
id=
"parameter2"
>
valueof2
</parameter>
\n
</instance>
]]>
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Template Hosting Subscription
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_slapos_rest_api_v1_test/PathTemplateItem/software_instance_module/template_software_instance.xml
0 → 100644
View file @
65cb6a3f
This diff is collapsed.
Click to expand it.
master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
View file @
65cb6a3f
...
@@ -41,7 +41,7 @@ class VifibSlaposRestAPIV1Mixin(ERP5TypeTestCase):
...
@@ -41,7 +41,7 @@ class VifibSlaposRestAPIV1Mixin(ERP5TypeTestCase):
def
createPerson
(
self
):
def
createPerson
(
self
):
customer
=
self
.
cloneByPath
(
'person_module/template_member'
)
customer
=
self
.
cloneByPath
(
'person_module/template_member'
)
customer_reference
=
'P'
+
self
.
test_random_id
customer_reference
=
'P'
+
self
.
generateNewId
()
customer
.
edit
(
customer
.
edit
(
reference
=
customer_reference
,
reference
=
customer_reference
,
default_email_url_string
=
customer_reference
+
'@example.com'
)
default_email_url_string
=
customer_reference
+
'@example.com'
)
...
@@ -364,6 +364,38 @@ class TestVifibSlaposRestAPIV1InstanceRequest(VifibSlaposRestAPIV1Mixin):
...
@@ -364,6 +364,38 @@ class TestVifibSlaposRestAPIV1InstanceRequest(VifibSlaposRestAPIV1Mixin):
# and with correct ones are set by default
# and with correct ones are set by default
class
TestVifibSlaposRestAPIV1Instance
(
VifibSlaposRestAPIV1Mixin
):
class
TestVifibSlaposRestAPIV1Instance
(
VifibSlaposRestAPIV1Mixin
):
def
afterSetUp
(
self
):
VifibSlaposRestAPIV1Mixin
.
afterSetUp
(
self
)
self
.
software_instance
=
self
.
createSoftwareInstance
(
self
.
customer
)
def
createSoftwareInstance
(
self
,
person
):
software_instance
=
self
.
cloneByPath
(
'software_instance_module/template_software_instance'
)
hosting_subscription
=
self
.
cloneByPath
(
'hosting_subscription_module/template_hosting_subscription'
)
software_instance
.
edit
(
reference
=
'SI'
+
self
.
test_random_id
,
ssl_key
=
'SSL Key'
,
ssl_certificate
=
'SSL Certificate'
)
software_instance
.
validate
()
hosting_subscription
.
edit
(
reference
=
'HS'
+
self
.
test_random_id
,
predecessor
=
software_instance
.
getRelativeUrl
(),
destination_section
=
person
.
getRelativeUrl
()
)
hosting_subscription
.
validate
()
transaction
.
commit
()
hosting_subscription
.
updateLocalRolesOnSecurityGroups
()
transaction
.
commit
()
hosting_subscription
.
recursiveImmediateReindexObject
()
transaction
.
commit
()
software_instance
.
manage_setLocalRoles
(
person
.
getReference
(),
[
'Assignee'
])
transaction
.
commit
()
software_instance
.
recursiveImmediateReindexObject
()
return
software_instance
def
test_OPTIONS_not_logged_in
(
self
):
def
test_OPTIONS_not_logged_in
(
self
):
self
.
connection
=
CustomHeaderHTTPConnection
(
host
=
self
.
api_netloc
,
self
.
connection
=
CustomHeaderHTTPConnection
(
host
=
self
.
api_netloc
,
custom_header
=
{
custom_header
=
{
...
@@ -376,3 +408,120 @@ class TestVifibSlaposRestAPIV1Instance(VifibSlaposRestAPIV1Mixin):
...
@@ -376,3 +408,120 @@ class TestVifibSlaposRestAPIV1Instance(VifibSlaposRestAPIV1Mixin):
self
.
assertResponseCode
(
204
)
self
.
assertResponseCode
(
204
)
self
.
assertResponseNoContentType
()
self
.
assertResponseNoContentType
()
self
.
assertSimulatorEmpty
()
self
.
assertSimulatorEmpty
()
def
test_software_instance_GET_non_existing
(
self
):
non_existing
=
'software_instance_module/'
+
self
.
generateNewId
()
try
:
self
.
portal
.
restrictedTraverse
(
non_existing
)
except
KeyError
:
pass
else
:
raise
AssertionError
(
'It was impossible to test'
)
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
non_existing
]),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
404
)
def
test_software_instance_GET_something_else
(
self
):
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
self
.
software_instance
.
getPredecessorRelatedValue
().
getRelativeUrl
()]),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
404
)
def
test_software_instance_GET
(
self
):
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
self
.
software_instance
.
getRelativeUrl
()]),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
200
)
self
.
assertResponseJson
()
self
.
assertEqual
({
"status"
:
"draft"
,
"connection"
:
{
"parameter1"
:
"valueof1"
,
"parameter2"
:
"https://niut:pass@example.com:4567/arfarf/oink?m=1#4.5"
},
"partition"
:
{
"public_ip"
:
[],
"tap_interface"
:
""
,
"private_ip"
:
[]},
"slave"
:
False
,
"children_list"
:
[],
"title"
:
"Template Software Instance"
,
"software_type"
:
"RootSoftwareInstance"
,
"parameter"
:
{
"parameter1"
:
"valueof1"
,
"parameter2"
:
"valueof2"
},
"software_release"
:
""
,
"sla"
:
{
"computer_guid"
:
"SOMECOMP"
}},
self
.
json_response
)
def
test_software_instance_GET_other_one
(
self
):
person
,
person_reference
=
self
.
createPerson
()
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
self
.
software_instance
.
getRelativeUrl
()]),
headers
=
{
'REMOTE_USER'
:
person_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
404
)
def
test_software_instance_GET_certificate
(
self
):
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
self
.
software_instance
.
getRelativeUrl
(),
'certificate'
]),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
200
)
self
.
assertResponseJson
()
self
.
assertEqual
({
"ssl_key"
:
"SSL Key"
,
"ssl_certificate"
:
"SSL Certificate"
},
self
.
json_response
)
def
test_software_instance_GET_certificate_non_existing
(
self
):
non_existing
=
'software_instance_module/'
+
self
.
generateNewId
()
try
:
self
.
portal
.
restrictedTraverse
(
non_existing
)
except
KeyError
:
pass
else
:
raise
AssertionError
(
'It was impossible to test'
)
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
non_existing
,
'certificate'
]),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
404
)
def
test_software_instance_GET_certificate_something_else
(
self
):
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
self
.
software_instance
.
getPredecessorRelatedValue
().
getRelativeUrl
(),
'certificate'
]),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
404
)
def
test_software_instance_GET_certificate_other_one
(
self
):
person
,
person_reference
=
self
.
createPerson
()
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
self
.
software_instance
.
getRelativeUrl
(),
'certificate'
]),
headers
=
{
'REMOTE_USER'
:
person_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
404
)
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
View file @
65cb6a3f
17
18
\ No newline at end of file
\ No newline at end of file
master/bt5/vifib_slapos_rest_api_v1_test/bt/template_path_list
0 → 100644
View file @
65cb6a3f
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