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
0
Merge Requests
0
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
Rafael Monnerat
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
Show 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):
def
__init__
(
self
,
logger
,
slap
):
self
.
logger
=
logger
self
.
slap
=
slap
self
.
__getattr__
=
self
.
get
def
get
(
self
,
software_product
):
self
.
get
=
self
.
__getattr__
def
__getattr__
(
self
,
software_product
):
self
.
logger
.
info
(
'Getting best Software Release corresponging to '
'this Software Product...'
)
software_release_list
=
\
...
...
slapos/tests/slap.py
View file @
b7b74e57
...
...
@@ -1143,15 +1143,17 @@ class TestSoftwareProductCollection(SlapMixin):
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.
"""
self
.
getSoftwareReleaseListFromSoftwareProduct_response
=
[]
self
.
getSoftwareReleaseListFromSoftwareProduct_response
=
[
'0'
]
self
.
product_collection
.
foo
self
.
assertEqual
(
self
.
product_collection
.
__getattr__
,
self
.
product_collection
.
get
)
self
.
assertEqual
(
self
.
product_collection
.
foo
,
'0'
)
if
__name__
==
'__main__'
:
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