This commit is contained in:
Manuel Ebert 2015-04-05 03:27:09 +04:00
parent 1543a93799
commit f459dd5bc2
3 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,5 @@
[2013-06-09 15:39] My first entry.
Everything is alright
[2013-06-10 15:40] Life is good.
But I'm better.

View file

@ -20,3 +20,9 @@ Feature: Exporting a Journal
and "tags" in the json output should contain "@journal"
and "tags" in the json output should not contain "@dan"
Scenario: Exporting dayone to json
Given we use the config "dayone.yaml"
When we run "jrnl --export json"
Then we should get no error
and the output should be parsable as json
and the json output should contain entries.0.uuid = "4BB1F46946AD439996C9B59DE7C4DDC1"

View file

@ -126,6 +126,22 @@ def check_output_field_key(context, field, key):
assert key in out_json[field]
@then('the json output should contain {path} = "{value}"')
def check_json_output_path(context, path, value):
""" E.g.
the json output should contain entries.0.title = "hello"
"""
out = context.stdout_capture.getvalue()
struct = json.loads(out)
for node in path.split('.'):
try:
struct = struct[int(node)]
except ValueError:
struct = struct[node]
assert struct == value, struct
@then('the output should be')
@then('the output should be "{text}"')
def check_output(context, text=None):