Template exporting FTW

This commit is contained in:
Manuel Ebert 2016-08-19 23:20:31 +00:00
parent f4dfecb62f
commit 60a955de20
12 changed files with 164 additions and 90 deletions

View file

@ -2,7 +2,7 @@ from __future__ import unicode_literals
from __future__ import absolute_import
from behave import given, when, then
from jrnl import cli, install, Journal, util
from jrnl import cli, install, Journal, util, plugins
from jrnl import __version__
from dateutil import parser as date_parser
from collections import defaultdict
@ -13,8 +13,8 @@ import keyring
class TestKeyring(keyring.backend.KeyringBackend):
"""A test keyring that just stores its valies in a hash
"""
"""A test keyring that just stores its valies in a hash"""
priority = 1
keys = defaultdict(dict)
@ -97,6 +97,13 @@ def run(context, command):
context.exit_status = e.code
@given('we load template "{filename}"')
def load_template(context, filename):
full_path = os.path.join("features/data/templates", filename)
exporter = plugins.template_exporter.__exporter_from_file(full_path)
plugins.__exporter_types[exporter.names[0]] = exporter
@when('we set the keychain password of "{journal}" to "{password}"')
def set_keychain(context, journal, password):
keyring.set_password('jrnl', journal, password)