mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-28 13:36:14 +02:00
Add extended metadata support for DayOne Classic (#928)
* Updating changelog [ci skip] * Incrementing version to v2.4 [ci skip] * [DayOne] remove extra spaces from the titles of edited DayOne entries Otherwise, a leading space was being introduced * [DayOne] maintain existing tags stored in DayOne metadata * [DayOne] brings back extended DayOne attributes * [DayOne] maintain metadata on edited entries Fixes #358, See also #159 * [DayOne Exporter] apply black formatting * [JSON Exporter] add support for extended DayOne Metadata * [DayOne] [Tests] test that extended DayOne metadata is added to new entries Co-authored-by: Jrnl Bot <jrnl.bot@gmail.com>
This commit is contained in:
parent
759c69c497
commit
404760876f
6 changed files with 160 additions and 8 deletions
|
@ -32,13 +32,21 @@ def check_output_field_not_key(context, field, key):
|
|||
@then('"{field}" in the json output should contain "{key}"')
|
||||
def check_output_field_key(context, field, key):
|
||||
out = context.stdout_capture.getvalue()
|
||||
out_json = json.loads(out)
|
||||
assert field in out_json
|
||||
assert key in out_json[field]
|
||||
struct = json.loads(out)
|
||||
|
||||
for node in field.split("."):
|
||||
try:
|
||||
struct = struct[int(node)]
|
||||
except ValueError:
|
||||
assert node in struct
|
||||
struct = struct[node]
|
||||
|
||||
assert key in struct
|
||||
|
||||
|
||||
@then("the json output should contain {path}")
|
||||
@then('the json output should contain {path} = "{value}"')
|
||||
def check_json_output_path(context, path, value):
|
||||
def check_json_output_path(context, path, value=None):
|
||||
""" E.g.
|
||||
the json output should contain entries.0.title = "hello"
|
||||
"""
|
||||
|
@ -50,7 +58,11 @@ def check_json_output_path(context, path, value):
|
|||
struct = struct[int(node)]
|
||||
except ValueError:
|
||||
struct = struct[node]
|
||||
assert struct == value, struct
|
||||
|
||||
if value is not None:
|
||||
assert struct == value, struct
|
||||
else:
|
||||
assert struct is not None
|
||||
|
||||
|
||||
@then("the output should be a valid XML string")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue