Merge branch 'master' into HEAD

This commit is contained in:
timetoplatypus 2017-09-09 10:23:17 -04:00
commit 7fefec0ca9
30 changed files with 725 additions and 70 deletions

View file

@ -0,0 +1,16 @@
{
"default_hour": 9,
"timeformat": "%Y-%m-%d %H:%M",
"linewrap": 80,
"encrypt": false,
"editor": "",
"default_minute": 0,
"highlight": true,
"password": "",
"journals": {
"simple": "features/journals/simple.journal",
"work": "features/journals/work.journal",
"ideas": "features/journals/nothing.journal"
},
"tagsymbols": "@"
}

View file

@ -35,7 +35,14 @@ Feature: Multiple journals
When we run "jrnl ideas 23 july 2012: sell my junk on ebay and make lots of money"
Then journal "ideas" should have 1 entry
<<<<<<< HEAD
Scenario: Don't crash if no default journal is specified
Given we use the config "bug343.yaml"
When we run "jrnl a long day in the office"
Then we should see the message "No default journal configured"
=======
Scenario: Gracefully handle a config without a default journal
Given we use the config "multiple_without_default.json"
When we run "jrnl fork this repo and fix something"
Then we should see the message "You have not specified a journal. Either provide a default journal in your config file, or specify one of your journals on the command line."
>>>>>>> master

View file

@ -70,6 +70,7 @@ Feature: Zapped bugs should stay dead.
| I'm feeling sore because I forgot to stretch.
"""
<<<<<<< HEAD
Scenario: DayOne tag searching should work with tags containing a mixture of upper and lower case.
# https://github.com/maebert/jrnl/issues/354
Given we use the config "dayone.yaml"
@ -78,3 +79,11 @@ Feature: Zapped bugs should stay dead.
"""
2013-05-17 11:39 This entry has tags!
"""
=======
Scenario: Writing an entry at the prompt with non-ascii characters
# https://github.com/maebert/jrnl/issues/295
Given we use the config "basic.json"
When we run "jrnl" and enter "Crème brûlée & Mötorhead"
Then we should get no error
and the journal should contain "Crème brûlée & Mötorhead"
>>>>>>> master

View file

@ -7,6 +7,7 @@ from jrnl import __version__
from dateutil import parser as date_parser
from collections import defaultdict
import os
<<<<<<< HEAD
import json
import yaml
import keyring
@ -31,6 +32,13 @@ class TestKeyring(keyring.backend.KeyringBackend):
keyring.set_keyring(TestKeyring())
=======
import codecs
import json
import keyring
import keyrings
keyring.set_keyring(keyrings.alt.file.PlaintextKeyring())
>>>>>>> master
try:
from io import StringIO
except ImportError:
@ -47,8 +55,14 @@ def ushlex(command):
def read_journal(journal_name="default"):
<<<<<<< HEAD
config = util.load_config(install.CONFIG_FILE_PATH)
with open(config['journals'][journal_name]) as journal_file:
=======
with open(cli.CONFIG_PATH) as config_file:
config = json.load(config_file)
with codecs.open(config['journals'][journal_name], 'r', 'utf-8') as journal_file:
>>>>>>> master
journal = journal_file.read()
return journal
@ -81,7 +95,11 @@ def run_with_input(context, command, inputs=None):
buffer = StringIO(text.strip())
util.STDIN = buffer
try:
<<<<<<< HEAD
cli.run(args or [])
=======
cli.run(args)
>>>>>>> master
context.exit_status = 0
except SystemExit as e:
context.exit_status = e.code
@ -91,7 +109,7 @@ def run_with_input(context, command, inputs=None):
def run(context, command):
args = ushlex(command)[1:]
try:
cli.run(args or None)
cli.run(args)
context.exit_status = 0
except SystemExit as e:
context.exit_status = e.code
@ -180,9 +198,14 @@ def check_output(context, text=None):
def check_output_time_inline(context, text):
out = context.stdout_capture.getvalue()
local_tz = tzlocal.get_localzone()
<<<<<<< HEAD
utc_time = date_parser.parse(text)
local_date = utc_time.astimezone(local_tz).strftime("%Y-%m-%d %H:%M")
assert local_date in out, local_date
=======
local_time = date_parser.parse(text).astimezone(local_tz).strftime("%Y-%m-%d %H:%M")
assert local_time in out, local_time
>>>>>>> master
@then('the output should contain')
@ -250,7 +273,11 @@ def config_var(context, key, value, journal=None):
@then('the journal should have {number:d} entry')
@then('journal "{journal_name}" should have {number:d} entries')
@then('journal "{journal_name}" should have {number:d} entry')
<<<<<<< HEAD
def check_journal_entries(context, number, journal_name="default"):
=======
def check_num_entries(context, number, journal_name="default"):
>>>>>>> master
journal = open_journal(journal_name)
assert len(journal.entries) == number