diff --git a/rootfs/api/__init__.py b/rootfs/api/__init__.py index 0ea2c6362..c5a692bda 100644 --- a/rootfs/api/__init__.py +++ b/rootfs/api/__init__.py @@ -2,4 +2,4 @@ The **api** Django app presents a RESTful web API for interacting with the **deis** system. """ -__version__ = '2.2.0' +__version__ = '2.3.0' diff --git a/rootfs/api/models/app.py b/rootfs/api/models/app.py index 73633a9f5..338b28941 100644 --- a/rootfs/api/models/app.py +++ b/rootfs/api/models/app.py @@ -735,7 +735,7 @@ def logs(self, log_lines=str(settings.LOG_LINES)): raise ServiceUnavailable('Error accessing deis-logger') # cast content to string since it comes as bytes via the requests object - return str(r.content) + return str(r.content.decode('utf-8')) def run(self, user, command): def pod_name(size=5, chars=string.ascii_lowercase + string.digits): diff --git a/rootfs/api/tests/test_app.py b/rootfs/api/tests/test_app.py index b44a4bac1..159c4223d 100644 --- a/rootfs/api/tests/test_app.py +++ b/rootfs/api/tests/test_app.py @@ -89,7 +89,7 @@ def test_app_override_id(self, mock_requests): self.assertContains(response, 'Application with this id already exists.', status_code=400) @mock.patch('requests.get') - def test_app_actions(self, mock_requests, mock_get): + def test_app_logs(self, mock_requests, mock_get): app_id = self.create_app() # test logs - 204 from deis-logger @@ -111,7 +111,8 @@ def test_app_actions(self, mock_requests, mock_get): self.assertContains( response, "Error accessing logs for {}".format(app_id), - status_code=500) + status_code=500 + ) # test logs - success accessing deis-logger mock_response.status_code = 200 @@ -125,9 +126,8 @@ def test_app_actions(self, mock_requests, mock_get): self.assertContains( response, "Error accessing logs for {}".format(app_id), - status_code=500) - - # TODO: test run needs an initial build + status_code=500 + ) @mock.patch('api.models.logger') def test_app_release_notes_in_logs(self, mock_requests, mock_logger): @@ -566,9 +566,9 @@ def test_get_private_registry_config_bad_registry_location(self, mock_requests): self.assertEqual(create, None) -FAKE_LOG_DATA = """ +FAKE_LOG_DATA = bytes(""" 2013-08-15 12:41:25 [33454] [INFO] Starting gunicorn 17.5 2013-08-15 12:41:25 [33454] [INFO] Listening at: http://0.0.0.0:5000 (33454) 2013-08-15 12:41:25 [33454] [INFO] Using worker: sync 2013-08-15 12:41:25 [33457] [INFO] Booting worker with pid 33457 -""" +""", 'utf-8')