diff --git a/pywps/inout/storage/file.py b/pywps/inout/storage/file.py index 99e04bbdb..447cd0b67 100644 --- a/pywps/inout/storage/file.py +++ b/pywps/inout/storage/file.py @@ -31,6 +31,13 @@ def _build_output_name(output): if not suffix: suffix = output.data_format.extension _, file_name = os.path.split(prefix) + + # Avoid misleading names for outputs: if the file name is the generic + # 'input' (the default used when downloading URL resources), use the + # output identifier instead so the reference URL is meaningful. + if file_name == 'input' and getattr(output, 'identifier', None): + file_name = output.identifier + output_name = file_name + suffix return output_name, suffix diff --git a/tests/test_dblog.py b/tests/test_dblog.py index d3707b52b..91b99d2c8 100644 --- a/tests/test_dblog.py +++ b/tests/test_dblog.py @@ -19,6 +19,12 @@ class DBLogTest(TestBase): def setUp(self): super().setUp() self.database = configuration.get_config_value('logging', 'database') + # Ensure a clean slate: other tests may have left rows in the + # process-instance table, which would make the content assertions + # below fail when the suite runs in a different order. + session = get_session() + session.query(ProcessInstance).delete() + session.commit() def test_0_dblog(self): """Test pywps.formats.Format class