Commit 1486fa1c authored by Mantas Zimnickas's avatar Mantas Zimnickas

Fix gsheetstomanifest script to also update property params

See: #809
parent 0bb11895
Pipeline #93306061 passed with stage
in 2 minutes and 37 seconds
......@@ -182,10 +182,12 @@ def _update_node(orig, data, depth=0):
if depth > len(levels) - 1:
# No more levels left, stop recursion.
return
children = None
else:
children = levels[depth]
# Some nodes, like models have two levels, so we need to handle that too.
if levels[depth] == '':
if children is not None and children == '':
for k in set(orig) | set(data):
if k in data:
if k in orig:
......@@ -196,8 +198,6 @@ def _update_node(orig, data, depth=0):
del orig[k]
return
children = levels[depth]
# Update node params, only changed keys are updated.
for k, v in data.items():
if k != children:
......
......@@ -16,7 +16,7 @@ def _read_rows(rows):
yield [x.strip() for x in line.split('|')]
def test_create_new_file(config, tmpdir):
def test_create_new_file(postgresql, config, tmpdir):
tmpdir = pathlib.Path(tmpdir)
context = create_test_context(config)
......@@ -69,7 +69,7 @@ def test_create_new_file(config, tmpdir):
}
def test_update_existing_file(config, tmpdir):
def test_update_existing_file(postgresql, config, tmpdir):
tmpdir = pathlib.Path(tmpdir)
(tmpdir / 'datasets/gov/vpt').mkdir(mode=0o755, parents=True)
......@@ -89,12 +89,12 @@ def test_update_existing_file(config, tmpdir):
' properties:',
' etapas:',
' type: string',
' const: award',
' const: awadr',
' org:',
' type: ref',
' object: org',
' object: ogr',
' # More comments',
' source: ORG # at the end of line',
' source: OGR # at the end of line',
' legacy:',
' type: string',
]))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment