json test

This commit is contained in:
= 2020-05-30 19:14:23 -04:00
parent 951a4a3dbb
commit 8e3a616413
2 changed files with 8 additions and 0 deletions

View file

@ -9,6 +9,8 @@ Feature: Exporting a Journal
And "tags" in the json output should contain "@idea"
And "tags" in the json output should contain "@journal"
And "tags" in the json output should contain "@dan"
And entry 1 should have an array called "tags" with 2 elements
And entry 2 should have an array called "tags" with 2 elements
Scenario: Exporting using filters should only export parts of the journal
Given we use the config "tags.yaml"

View file

@ -52,6 +52,12 @@ def check_json_output_path(context, path, value):
struct = struct[node]
assert struct == value, struct
@then('entry {entry_number:d} should have an array called "{name}" with {items_number:d} elements')
def entry_array_count(context,entry_number,name,items_number):
#note that entry_number is 1-indexed.
out = context.stdout_capture.getvalue()
out_json = json.loads(out)
assert len(out_json["entries"][entry_number-1][name])==items_number
@then("the output should be a valid XML string")
def assert_valid_xml_string(context):