Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions remoteappmanager/webapi/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ def items(self, items_response, **kwargs):
user_name=self.current_user.name,
mapping_id=accounting.id)

if container is None:
continue

rest_container = Container(identifier=container.url_id)
rest_container.fill(container)
running_containers.append(rest_container)
Expand Down
33 changes: 25 additions & 8 deletions remoteappmanager/webapi/tests/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def get_app(self):
def test_items(self):
manager = self._app.container_manager
manager.image = mock_coro_factory(Image())
manager.find_containers = mock_coro_factory(
[
manager.find_containers = mock_coro_factory([
DockerContainer(user="johndoe",
mapping_id="whatever",
url_id="12345",
Expand All @@ -48,12 +47,30 @@ def test_items(self):
'total': 2,
'offset': 0,
'items': {
'12345': {
'image_name': 'image',
'name': 'container',
'mapping_id': 'whatever'
}
}})
'12345': {
'image_name': 'image',
'name': 'container',
'mapping_id': 'whatever'
}
}})

def test_items_with_none_container(self):
manager = self._app.container_manager
manager.image = mock_coro_factory(Image())
manager.find_container = mock_coro_factory(None)

code, data = self.get("/user/johndoe/api/v1/containers/",
httpstatus.OK)

self.assertEqual(
data,
{
'identifiers': [],
'total': 0,
'offset': 0,
'items': {}
}
)

def test_create(self):
with patch("remoteappmanager"
Expand Down