mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 04:58:32 +02:00
implement test steps
This commit is contained in:
parent
3626e44861
commit
2f25e5cd12
1 changed files with 13 additions and 0 deletions
|
@ -1,17 +1,30 @@
|
|||
# Copyright (C) 2012-2021 jrnl contributors
|
||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from jrnl.cli import cli
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import random
|
||||
import string
|
||||
from unittest import mock
|
||||
from xml.etree import ElementTree
|
||||
|
||||
from behave import given
|
||||
from behave import then
|
||||
from jrnl.jrnl import search_mode
|
||||
from jrnl.Entry import Entry
|
||||
from jrnl.plugins import get_exporter
|
||||
|
||||
@then("the output should be pretty printed text")
|
||||
def check_output_text(context):
|
||||
with mock.patch('jrnl.Entry.Entry.pprint',wraps=Entry.pprint) as mock_entry_pprint, \
|
||||
mock.patch('jrnl.jrnl.search_mode',wraps=search_mode) as mock_search_mode, \
|
||||
mock.patch('jrnl.plugins.get_exporter', wraps=get_exporter) as mock_exporter :
|
||||
cli(context.args)
|
||||
|
||||
mock_exporter.assert_called_once_with('pretty')
|
||||
|
||||
@then("the output should be parsable as json")
|
||||
def check_output_json(context):
|
||||
out = context.stdout_capture.getvalue()
|
||||
|
|
Loading…
Add table
Reference in a new issue