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
Léo-Paul Géneau
slapos.core
Commits
b7b74e57
Commit
b7b74e57
authored
Nov 25, 2014
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.slap: fix __getattr__ of product collection.
so that product.foo works.
parent
626cedb7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
slapos/slap/slap.py
slapos/slap/slap.py
+3
-2
slapos/tests/slap.py
slapos/tests/slap.py
+6
-4
No files found.
slapos/slap/slap.py
View file @
b7b74e57
...
@@ -177,8 +177,9 @@ class SoftwareProductCollection(object):
...
@@ -177,8 +177,9 @@ class SoftwareProductCollection(object):
def
__init__
(
self
,
logger
,
slap
):
def
__init__
(
self
,
logger
,
slap
):
self
.
logger
=
logger
self
.
logger
=
logger
self
.
slap
=
slap
self
.
slap
=
slap
self
.
__getattr__
=
self
.
get
self
.
get
=
self
.
__getattr__
def
get
(
self
,
software_product
):
def
__getattr__
(
self
,
software_product
):
self
.
logger
.
info
(
'Getting best Software Release corresponging to '
self
.
logger
.
info
(
'Getting best Software Release corresponging to '
'this Software Product...'
)
'this Software Product...'
)
software_release_list
=
\
software_release_list
=
\
...
...
slapos/tests/slap.py
View file @
b7b74e57
...
@@ -1065,7 +1065,7 @@ class TestOpenOrder(SlapMixin):
...
@@ -1065,7 +1065,7 @@ class TestOpenOrder(SlapMixin):
computer_partition
=
open_order
.
request
(
software_release_uri
,
'myrefe'
)
computer_partition
=
open_order
.
request
(
software_release_uri
,
'myrefe'
)
self
.
assertIsInstance
(
computer_partition
,
slapos
.
slap
.
ComputerPartition
)
self
.
assertIsInstance
(
computer_partition
,
slapos
.
slap
.
ComputerPartition
)
self
.
assertEqual
(
requested_partition_id
,
computer_partition
.
getId
())
self
.
assertEqual
(
requested_partition_id
,
computer_partition
.
getId
())
self
.
assertEqual
(
"URL_CONNECTION_PARAMETER"
,
self
.
assertEqual
(
"URL_CONNECTION_PARAMETER"
,
computer_partition
.
getConnectionParameter
(
'url'
))
computer_partition
.
getConnectionParameter
(
'url'
))
...
@@ -1097,7 +1097,7 @@ class TestOpenOrder(SlapMixin):
...
@@ -1097,7 +1097,7 @@ class TestOpenOrder(SlapMixin):
computer_partition
=
open_order
.
request
(
software_release_uri
,
'myrefe'
)
computer_partition
=
open_order
.
request
(
software_release_uri
,
'myrefe'
)
self
.
assertIsInstance
(
computer_partition
,
slapos
.
slap
.
ComputerPartition
)
self
.
assertIsInstance
(
computer_partition
,
slapos
.
slap
.
ComputerPartition
)
self
.
assertEqual
(
requested_partition_id
,
computer_partition
.
getId
())
self
.
assertEqual
(
requested_partition_id
,
computer_partition
.
getId
())
self
.
assertEqual
(
"URL_CONNECTION_PARAMETER"
,
self
.
assertEqual
(
"URL_CONNECTION_PARAMETER"
,
computer_partition
.
getConnectionParameter
(
'url'
))
computer_partition
.
getConnectionParameter
(
'url'
))
...
@@ -1143,15 +1143,17 @@ class TestSoftwareProductCollection(SlapMixin):
...
@@ -1143,15 +1143,17 @@ class TestSoftwareProductCollection(SlapMixin):
self
.
product_collection
.
get
,
'random_reference'
,
self
.
product_collection
.
get
,
'random_reference'
,
)
)
def
test_get_product_get
t
attr
(
self
):
def
test_get_product_getattr
(
self
):
"""
"""
Test that __getattr__ method is bound to get() method.
Test that __getattr__ method is bound to get() method.
"""
"""
self
.
getSoftwareReleaseListFromSoftwareProduct_response
=
[]
self
.
getSoftwareReleaseListFromSoftwareProduct_response
=
[
'0'
]
self
.
product_collection
.
foo
self
.
assertEqual
(
self
.
assertEqual
(
self
.
product_collection
.
__getattr__
,
self
.
product_collection
.
__getattr__
,
self
.
product_collection
.
get
self
.
product_collection
.
get
)
)
self
.
assertEqual
(
self
.
product_collection
.
foo
,
'0'
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
print
'You can point to any SLAP server by setting TEST_SLAP_SERVER_URL '
\
print
'You can point to any SLAP server by setting TEST_SLAP_SERVER_URL '
\
...
...
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