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
Nicolas Wavrant
slapos.core
Commits
2db65ba9
Commit
2db65ba9
authored
Jan 15, 2014
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[slap] Include tests for getConnectionParameter
parent
a2b29c76
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
slapos/tests/slap.py
slapos/tests/slap.py
+56
-0
No files found.
slapos/tests/slap.py
View file @
2db65ba9
...
...
@@ -874,6 +874,62 @@ class TestOpenOrder(SlapMixin):
self
.
assertEqual
(
requested_partition_id
,
computer_partition
.
getId
())
def
test_request_getConnectionParameter
(
self
):
""" Backward compatibility API for slapproxy older them 1.0.1 """
software_release_uri
=
'http://server/new/'
+
self
.
_getTestComputerId
()
self
.
slap
=
slapos
.
slap
.
slap
()
self
.
slap
.
initializeConnection
(
self
.
server_url
)
# XXX: Interface lack registerOpenOrder method declaration
open_order
=
self
.
slap
.
registerOpenOrder
()
computer_guid
=
self
.
_getTestComputerId
()
requested_partition_id
=
'PARTITION_01'
def
server_response
(
self
,
path
,
method
,
body
,
header
):
from
slapos.slap.slap
import
SoftwareInstance
slap_partition
=
SoftwareInstance
(
_connection_dict
=
{
"url"
:
'URL_CONNECTION_PARAMETER'
},
slap_computer_id
=
computer_guid
,
slap_computer_partition_id
=
requested_partition_id
)
return
(
200
,
{},
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_partition
))
httplib
.
HTTPConnection
.
_callback
=
server_response
computer_partition
=
open_order
.
request
(
software_release_uri
,
'myrefe'
)
self
.
assertIsInstance
(
computer_partition
,
slapos
.
slap
.
ComputerPartition
)
self
.
assertEqual
(
requested_partition_id
,
computer_partition
.
getId
())
self
.
assertEqual
(
"URL_CONNECTION_PARAMETER"
,
computer_partition
.
getConnectionParameter
(
'url'
))
def
test_request_connection_dict_backward_compatibility
(
self
):
""" Backward compatibility API for slapproxy older them 1.0.1 """
software_release_uri
=
'http://server/new/'
+
self
.
_getTestComputerId
()
self
.
slap
=
slapos
.
slap
.
slap
()
self
.
slap
.
initializeConnection
(
self
.
server_url
)
# XXX: Interface lack registerOpenOrder method declaration
open_order
=
self
.
slap
.
registerOpenOrder
()
computer_guid
=
self
.
_getTestComputerId
()
requested_partition_id
=
'PARTITION_01'
def
server_response
(
self
,
path
,
method
,
body
,
header
):
from
slapos.slap.slap
import
SoftwareInstance
slap_partition
=
SoftwareInstance
(
connection_xml
=
"""<?xml version='1.0' encoding='utf-8'?>
<instance>
<parameter id="url">URL_CONNECTION_PARAMETER</parameter>
</instance>"""
,
slap_computer_id
=
computer_guid
,
slap_computer_partition_id
=
requested_partition_id
)
return
(
200
,
{},
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_partition
))
httplib
.
HTTPConnection
.
_callback
=
server_response
computer_partition
=
open_order
.
request
(
software_release_uri
,
'myrefe'
)
self
.
assertIsInstance
(
computer_partition
,
slapos
.
slap
.
ComputerPartition
)
self
.
assertEqual
(
requested_partition_id
,
computer_partition
.
getId
())
import
pdb
;
pdb
.
set_trace
()
self
.
assertEqual
(
"URL_CONNECTION_PARAMETER"
,
computer_partition
.
getConnectionParameter
(
'url'
))
class
TestSoftwareProductCollection
(
SlapMixin
):
...
...
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