diff --git a/apiserver/storage/JsonFileStorageAdapter.py b/apiserver/storage/JsonFileStorageAdapter.py index e8fbc6ff87b63418e8bf5498c633ea6b702060d4..86a9972f4fc8c38b9cc3fb2cf18233a6ebf73f33 100644 --- a/apiserver/storage/JsonFileStorageAdapter.py +++ b/apiserver/storage/JsonFileStorageAdapter.py @@ -29,12 +29,12 @@ class JsonFileStorageAdapter(AbstractLocationDataStorageAdapter): if not (os.path.exists(self.data_dir) and os.path.isdir(self.data_dir)): raise Exception('Data Directory \"' + self.data_dir + '\" does not exist.') - def getList(self, type: LocationDataType): + def getList(self, type: LocationDataType) -> List: localpath = os.path.join(self.data_dir, type.value) if not (os.path.isdir(localpath)): # This type has apparently not yet been used at all, create its directory and return an empty json file os.mkdir(localpath) - return {} + return [] else: allFiles = [f for f in os.listdir(localpath) if os.path.isfile(os.path.join(localpath, f))] # now each file has to be checked for its filename (= id) and the LocationData name (which is inside the json) diff --git a/tests/storage_tests/test_jsonbackend.py b/tests/storage_tests/test_jsonbackend.py index 122a11e91efa35a53df98fadc67b633772caf130..01369bf9e099280cefff7827d9011056e69375d1 100644 --- a/tests/storage_tests/test_jsonbackend.py +++ b/tests/storage_tests/test_jsonbackend.py @@ -25,5 +25,5 @@ class SomeTests(unittest.TestCase): def test_getList(self): test_type = LocationDataType.DATASET lst = self.store.getList(type=test_type) - self.assertEqual(lst, {}, 'Id should not be none') + self.assertEqual(lst, [], 'Id should not be none') \ No newline at end of file