Skip to content
Snippets Groups Projects
Commit 381d40d2 authored by Jedrzej Rybicki's avatar Jedrzej Rybicki
Browse files

getList should return list

parent bc76e55c
No related branches found
No related tags found
No related merge requests found
Pipeline #68744 passed
......@@ -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)
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment