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
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
3216f6c3
Commit
3216f6c3
authored
Oct 02, 2012
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests on parameters setting for slapproxy
parent
376918c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
8 deletions
+25
-8
slapos/tests/slapproxy.py
slapos/tests/slapproxy.py
+25
-8
No files found.
slapos/tests/slapproxy.py
View file @
3216f6c3
...
...
@@ -288,25 +288,42 @@ class TestRequest (MasterMixin, unittest.TestCase):
self
.
request
(
'http://sr//'
,
None
,
'Maria'
,
'slappart2'
).
__dict__
,
self
.
request
(
'http://sr//'
,
None
,
'Maria'
,
'slappart2'
).
__dict__
)
def
test_two_
same_request_from_one_partition_different_parameters
(
self
):
def
test_two_
requests_with_different_parameters_but_same_reference
(
self
):
"""
Request will return same partition for two equal requests
Request will return same partition for two different requests but will
only update parameters
"""
self
.
add_free_partition
(
2
)
wanted_domain1
=
'fou.org'
wanted_domain2
=
'carzy.org'
request1
=
self
.
request
(
'http://sr//'
,
None
,
'Maria'
,
'slappart2'
,
partition_parameter_kw
=
{
'domain'
:
wanted_domain1
})
request1_dict
=
request1
.
__dict__
requested_result1
=
self
.
getPartitionInformation
(
request1_dict
[
'_partition_id'
])
request2
=
self
.
request
(
'http://sr1//'
,
'Papa'
,
'Maria'
,
'slappart2'
,
partition_parameter_kw
=
{
'domain'
:
wanted_domain2
})
request1_dict
=
request1
.
__dict__
request2_dict
=
request2
.
__dict__
requested_result2
=
self
.
getPartitionInformation
(
request2_dict
[
'_partition_id'
])
# Test we received same partition
for
key
in
request1_dict
:
if
not
key
in
(
"_partition_id"
,
"_computer_id"
):
if
request1_dict
[
key
]
is
not
None
and
request2_dict
[
key
]
is
not
None
:
self
.
assertNotEqual
(
request1_dict
[
key
],
request2_dict
[
key
])
else
:
self
.
assertEqual
(
request1_dict
[
key
],
request2_dict
[
key
])
self
.
assertEqual
(
request1_dict
[
key
],
request2_dict
[
key
])
# Test that only parameters changed
for
key
in
requested_result2
.
__dict__
:
if
not
key
in
(
'_parameter_dict'
,
'_software_release_document'
):
self
.
assertEqual
(
requested_result2
.
__dict__
[
key
],
requested_result1
.
__dict__
[
key
])
elif
key
in
(
'_software_release_document'
):
self
.
assertEqual
(
requested_result2
.
__dict__
[
key
].
__dict__
,
requested_result1
.
__dict__
[
key
].
__dict__
)
#Test parameters where set correctly
self
.
assertEqual
(
wanted_domain1
,
requested_result1
.
_parameter_dict
[
'domain'
])
self
.
assertEqual
(
wanted_domain2
,
requested_result2
.
_parameter_dict
[
'domain'
])
def
test_two_different_request_from_two_partition
(
self
):
"""
...
...
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