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
4 changes: 3 additions & 1 deletion pywps/inout/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,9 @@ def storage(self, storage):
def get_url(self):
"""Return URL pointing to data
"""
url = self.storage.url(self)
# TODO: it is not obvious that storing happens here
(_, _, url) = self.storage.store(self)
# url = self.storage.url(self)
return url


Expand Down
4 changes: 2 additions & 2 deletions pywps/inout/storage/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def _do_store(self, output):

just_file_name = os.path.basename(output_name)

url = self.url(urljoin(str(request_uuid), just_file_name))
url = self.url("{}/{}".format(request_uuid, just_file_name))
LOGGER.info('File output URI: {}'.format(url))

return (STORE_TYPE.PATH, output_name, url)
Expand All @@ -131,7 +131,7 @@ def url(self, destination):
if isinstance(destination, IOHandler):
output_name, _ = _build_output_name(destination)
just_file_name = os.path.basename(output_name)
dst = urljoin(str(destination.uuid), just_file_name)
dst = "{}/{}".format(destination.uuid, just_file_name)
else:
dst = destination

Expand Down
8 changes: 4 additions & 4 deletions tests/test_filestorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import unittest


class FileStorageTests(unittest.TestCase):

def setUp(self):
Expand Down Expand Up @@ -42,7 +43,6 @@ def test_store(self):
with open(self.tmp_dir + '/' + store_str) as f:
self.assertEqual(f.read(), "Hello World!")


def test_write(self):
configuration.CONFIG.set('server', 'outputpath', self.tmp_dir)
configuration.CONFIG.set('server', 'outputurl', 'file://' + self.tmp_dir)
Expand All @@ -61,16 +61,16 @@ def test_url(self):
storage = FileStorageBuilder().build()
output = ComplexOutput('testme', 'Test', supported_formats=[FORMATS.TEXT], workdir=self.tmp_dir)
output.data = "Hello World!"
output.uuid = '595129f0-1a6c-11ea-a30c-acde48001122'
url = storage.url(output)

self.assertEqual('file://' + self.tmp_dir + '/input.txt', url)
self.assertEqual('file://' + self.tmp_dir + '/595129f0-1a6c-11ea-a30c-acde48001122' + '/input.txt', url)

file_name = 'test.txt'
url = storage.url(file_name)

self.assertEqual('file://' + self.tmp_dir + '/test.txt', url)


def test_location(self):
configuration.CONFIG.set('server', 'outputpath', self.tmp_dir)
storage = FileStorageBuilder().build()
Expand All @@ -88,4 +88,4 @@ def load_tests(loader=None, tests=None, pattern=None):
suite_list = [
loader.loadTestsFromTestCase(FileStorageTests)
]
return unittest.TestSuite(suite_list)
return unittest.TestSuite(suite_list)