Skip to content

Commit

Permalink
Fix the return type of the root request (#71)
Browse files Browse the repository at this point in the history
Signed-off-by: David Brown <dmlb2000@gmail.com>
  • Loading branch information
dmlb2000 committed Jan 23, 2019
1 parent adda86d commit 11a37e5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ install:
C:\pacifica\Scripts\activate.ps1;
python -m pip install --upgrade pip setuptools wheel;
python -m pip install -r requirements-dev.txt;
echo 'Done';
build: off

Expand Down
4 changes: 2 additions & 2 deletions pacifica/archiveinterface/rest_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import shutil
from json import dumps
import cherrypy
from .archive_utils import get_http_modified_time, file_status
from .archive_utils import get_http_modified_time, file_status, bytes_type
from .exception import ArchiveInterfaceError

BLOCK_SIZE = 1 << 20
Expand Down Expand Up @@ -48,7 +48,7 @@ def GET(self, *args):
# if asking for / then return a message that the archive is working
if not args:
cherrypy.response.headers['Content-Type'] = 'application/json'
return {'message': 'Pacifica Archive Interface Up and Running'}
return bytes_type(dumps({'message': 'Pacifica Archive Interface Up and Running'}))
archivefile = self._archive.open(args[0], 'r')
cherrypy.response.headers['Content-Type'] = 'application/octet-stream'

Expand Down
3 changes: 2 additions & 1 deletion tests/interface_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""File used to unit test the pacifica archive interface."""
from json import loads
import unittest
import time
from pacifica.archiveinterface.archive_utils import un_abs_path, get_http_modified_time
Expand Down Expand Up @@ -130,6 +131,6 @@ def test_generator_get(self):
factory = ArchiveBackendFactory()
backend = factory.get_backend_archive('posix', '/tmp')
generator = ArchiveInterfaceGenerator(backend)
jsn = generator.GET()
jsn = loads(generator.GET())
self.assertEqual(
jsn['message'], 'Pacifica Archive Interface Up and Running')

0 comments on commit 11a37e5

Please sign in to comment.