Skip to content

Commit a1f8020

Browse files
committed
Merge branch 'master' into release-2.0.0
2 parents b04c26c + 22750c3 commit a1f8020

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

alembic.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ script_location = alembic/
2929
# are written from script.py.mako
3030
# output_encoding = utf-8
3131

32-
sqlalchemy.url = sqlite://jupyterhub/remoteappmanager.db
32+
sqlalchemy.url = sqlite:///jupyterhub/remoteappmanager.db
3333

3434

3535
# Logging configuration

remoteappmanager/webapi/container.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ def items(self, items_response, **kwargs):
163163
user_name=self.current_user.name,
164164
mapping_id=accounting.id)
165165

166+
if container is None:
167+
continue
168+
166169
rest_container = Container(identifier=container.url_id)
167170
rest_container.fill(container)
168171
running_containers.append(rest_container)

remoteappmanager/webapi/tests/test_container.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ def get_app(self):
2525
def test_items(self):
2626
manager = self._app.container_manager
2727
manager.image = mock_coro_factory(Image())
28-
manager.find_containers = mock_coro_factory(
29-
[
28+
manager.find_containers = mock_coro_factory([
3029
DockerContainer(user="johndoe",
3130
mapping_id="whatever",
3231
url_id="12345",
@@ -48,12 +47,30 @@ def test_items(self):
4847
'total': 2,
4948
'offset': 0,
5049
'items': {
51-
'12345': {
52-
'image_name': 'image',
53-
'name': 'container',
54-
'mapping_id': 'whatever'
55-
}
56-
}})
50+
'12345': {
51+
'image_name': 'image',
52+
'name': 'container',
53+
'mapping_id': 'whatever'
54+
}
55+
}})
56+
57+
def test_items_with_none_container(self):
58+
manager = self._app.container_manager
59+
manager.image = mock_coro_factory(Image())
60+
manager.find_container = mock_coro_factory(None)
61+
62+
code, data = self.get("/user/johndoe/api/v1/containers/",
63+
httpstatus.OK)
64+
65+
self.assertEqual(
66+
data,
67+
{
68+
'identifiers': [],
69+
'total': 0,
70+
'offset': 0,
71+
'items': {}
72+
}
73+
)
5774

5875
def test_create(self):
5976
with patch("remoteappmanager"

0 commit comments

Comments
 (0)