Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Simon János
/
orchestrator
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ecd35a12
authored
Nov 18, 2016
by
Simon János
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "getitem and delitem implemented on resource group"
This reverts commit
9c6303cc
parent
cd57400f
Pipeline
#286
passed with stage
in 31 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
42 deletions
+1
-42
orchestrator/model/resources.py
+0
-6
tests/test_resources.py
+1
-36
No files found.
orchestrator/model/resources.py
View file @
ecd35a12
...
...
@@ -130,12 +130,6 @@ class ResourceGroup(Resource):
except
InvalidResourceException
:
del
self
.
__resources
[
resource
.
id
]
def
__getitem__
(
self
,
resource_id
):
return
self
.
__resources
[
resource_id
]
def
__delitem__
(
self
,
resource_id
):
self
.
remove
(
self
[
resource_id
])
@property
def
resources
(
self
):
return
list
(
self
.
__resources
.
values
())
...
...
tests/test_resources.py
View file @
ecd35a12
from
__future__
import
print_function
import
copy
import
json
from
unittest.case
import
TestCase
...
...
@@ -210,40 +208,7 @@ class ResourceGroupTest(TestCase):
# then
self
.
assertEqual
([],
group
.
resources
)
def
test_resource_group_del_item_by_id
(
self
):
# given
expected_resource_id
=
'some_resource'
expected_resource
=
Instance
(
id
=
expected_resource_id
)
group
=
ResourceGroup
(
resources
=
[
expected_resource
])
# when
del
group
[
expected_resource_id
]
# then
self
.
assertNotIn
(
expected_resource
,
group
.
resources
)
def
test_resource_group_del_invalid_id
(
self
):
# given
group
=
ResourceGroup
()
# then
with
self
.
assertRaises
(
KeyError
):
del
group
[
'invalid_resource_id'
]
def
test_resource_group_get_item_by_id
(
self
):
# given
expected_resource_id
=
'some_resource'
expected_resource
=
Instance
(
id
=
expected_resource_id
)
group
=
ResourceGroup
(
resources
=
[
expected_resource
])
# when
result
=
group
[
expected_resource_id
]
# then
self
.
assertEqual
(
expected_resource
,
result
)
with
self
.
assertRaises
(
KeyError
):
print
(
group
[
'invalid_resource_id'
])
# @skip('works same way as resource addition')
def
test_resource_group_addition
(
self
):
# given
group1
=
ResourceGroup
()
...
...
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