Skip to content

Commit

Permalink
Set as_reference to False for some ComplexOutput (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
huard authored and cehbrecht committed Dec 14, 2018
1 parent 9de5bd2 commit 3c2b1aa
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions emu/processes/wps_inout.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def __init__(self):
data_type='string'),
ComplexOutput('text', 'Text',
abstract='Copy of input text file.',
as_reference=True,
supported_formats=[Format('text/plain')]),
as_reference=False,
supported_formats=[FORMATS.TEXT, ]),
ComplexOutput('dataset', 'Dataset',
abstract='Copy of input netcdf file.',
as_reference=True,
Expand Down Expand Up @@ -141,7 +141,7 @@ def _handler(request, response):
# TODO: bbox is not working
# response.outputs['bbox'].data = request.inputs['bbox'][0].data
# TODO: how to copy file?
response.outputs['text'].data_format = Format('text/plain')
response.outputs['text'].data_format = FORMATS.TEXT
if 'text' in request.inputs:
response.outputs['text'].file = request.inputs['text'][0].file
else:
Expand Down
4 changes: 2 additions & 2 deletions emu/processes/wps_ncmeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def __init__(self):
super(NCMeta, self).__init__(
self._handler,
identifier='ncmeta',
title='Show NetCDF Metadata',
abstract="Dataset can be either a NetCDF file or an OpenDAP service.",
title='Return NetCDF Metadata',
abstract="Return metadata from a netCDF dataset, either on file or an OpenDAP service.",
version='4',
metadata=[
Metadata('User Guide', 'http://emu.readthedocs.io/en/latest/'),
Expand Down
2 changes: 1 addition & 1 deletion emu/processes/wps_output_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self):
supported_formats=[FORMATS.NETCDF, ]),
ComplexOutput('json', 'json dummy output file.',
abstract="A very small test json file. ",
as_reference=True,
as_reference=False,
supported_formats=[FORMATS.JSON, ]),
]

Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
- defaults
dependencies:
- six
- pywps>=4.1.22
- pywps>=4.1.26
- jinja2
- click
- psutil
Expand Down
14 changes: 9 additions & 5 deletions tests/test_wps_inout.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import pytest

import os
from pywps import Service
from pywps.tests import assert_response_success

from .common import client_for
from .common import client_for, get_output, resource_file
from emu.processes.wps_inout import InOut

NC_FILE_URL = "file://{}".format(resource_file('test.nc'))


def test_wps_inout():
client = client_for(Service(processes=[InOut()]))
datainputs = "string=onetwothree;int=7;float=2.0;boolean=0"
datainputs = "string=onetwothree;int=7;float=2.0;boolean=0;text=some string;dataset=@xlink:href={}"
resp = client.get(
service='WPS', request='Execute', version='1.0.0', identifier='inout',
datainputs=datainputs)
print(resp.data)
datainputs=datainputs.format(NC_FILE_URL))
assert_response_success(resp)
out = get_output(resp.xml)
assert out['text'] == 'some string'
assert out['dataset'].endswith('.nc')

0 comments on commit 3c2b1aa

Please sign in to comment.