Commit graph

49 commits

Author SHA1 Message Date
joaquin garmendia
8c2de0e6d7
Add display format option to config file. (#1050)
* Add display format option to config file.
* Add tests.
* Fix `black` error.
* Change nested if to top level.
2020-10-17 18:53:34 -07:00
Jonathan Wren
d916f66dbf
[WIP] Lots of test refactoring (#1042)
* make behave slightly less verbose for use with behave --format progress2
* standardize behave tests
* move tests around to be more behavior driven
* clean up txt file after tests
* add more tests, add more functionality to behave for calling mock editor
* move around behave tests, get rid of regression files
* clean up some code around keyrings
* add more placeholder test scenarios (marked with @todo)
  You can run just these tests with `behave --no-skipped --tags=todo`
* fix "missing_directory" test
  This test was missing the config file it was trying to use. So, it was
  really a very useless, broken test that we absolutely should not have
  approved the PR (#963) for.
* add write tests for each journal type
* update version tests, add new regex match behave step
* add config test outlines
* add journal types to some search tests
* change "basic" config reference to "simple"
* update configs
* add more journal types in search
* fix basic folder journal reference
* add flush output steps to behave, update delete flag tests
* fix failing test with a flush
* update more delete flag tests to include other journal types
* fix file cleanup after failed test with no debug on
* fix password test
* fix DayOne tag sample data, move search/format tag tests, and run them on multiple jrnl types
* added ability to auto-prompt for password for encrypted journals
  Only uses password when prompted, and doesn't get in the way of other
  input prompts. This allows us to run the same scenarios on both
  encrypted journals and other journal types.
* fold encrypted scenarios into the rest of the scenarios where possible
* remove apostrophe that is breaking tests on CI
* add more journal type tests to import feature
* standardize whitespace in behave tests, take out duplicate test
* update handling of cache directories in test suite (easier syntax)
* skip failing YAML exporter emoji test on Windows
* added @todo tags for things that need follow-up

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2020-10-17 15:17:38 -07:00
Jonathan Wren
a11aa24c7e Allow editing of DayOne entries (#1001)
* add test to repro issue #955

* Allow editing of DayOne entries

* Add broken test for Dayone

Add test for editing Dayone entries (this test currently fails)

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>

* Fix editing logic for DayOneJournal

DayOneJournal previously reimplemented Journal._parse inside of
DayOneJournal.parse_editable_string, and in doing so caused issues
between itself and the class it was inheriting from. This commit fixes
the issue by moving the UUID to be in the body of the entry, rather than
above it. So, then Journal._parse still finds the correct boundaries
between entries, and DayOneJournal then parses the UUID afterward.

Co-authored-by: MinchinWeb <w_minchin@hotmail.com>
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2020-07-18 12:54:52 -07:00
Jonathan Wren
a4d020423f Fix editor config when an argument with a space is used (#953)
* Fix editor config when an argument with a space is used
* skip broken test on windows
* fix jrnl not behaving nicely with testing suite
* fix argument parsing for test suite
* fix one windows test, disable one windows test
2020-05-23 15:56:31 -07:00
Micah Jerome Ellison
d9ebfe852b Prevent filtered delete from deleting journal (#935)
* Prevent filtered deletion from deleting entire journal #932 and add lots of deletion tests
* Undo removal of deletion feature
* Use more performant deletion
2020-05-06 13:47:39 -07:00
dbxnr
65a3b2ce7c Fix for upgrade with missing journal (#796)
* Fix for upgrade with missing journal
* add test, refactor solution
* add missing test config

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2020-04-10 16:18:34 -07:00
Aaron Lichtman
f4fca3e5a4 Add --delete for interactive removal of entries (#698)
* Add --delete for interactive removal of entries
* Add inquirer dependency for fancy prompting
* Fix some minor style issues
* Fix #434 
* Use PyInquirer instead of inquirer for Windows compatibility
* Add WIP (broken) test
* Change deletion interface to be more basic
* Update environment.py

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2020-04-10 16:18:34 -07:00
Aaron Lichtman
9e5d160bbd Pretty print journal entries (#692)
* Pretty print journal entry titles and dates.

Changes appearance of all jrnl viewing commands, such as $ jrnl --short and
$ jrnl -n {NUM}.

Fix #508

* Removed extra newline at end of title

* Use ansiwrap to properly wrap strings with ANSI escapes

* Add ansiwrap to pyproject.toml

* Allow configuration of colors

- Replaced raw escapes with colorama
- Added colors key to config
- Add checks for validity of color values

* Add color configuration documentation

* Fix broken tests due to config change

* Add tests for colors in configs

- Identifying invalid color configs
- Upgrading config from no colors -> colors

* Add colorama dependency for all platforms

* Allow users to disable colorization of output

* Update poetry.lock

* Add tag and body color customization options

* Fix colorization of tags in title and body

* Updated tests to use no color by default

* Change pass to continue in verify_config()

* Better style in Entry.py

* Reduce code duplication for tag highlighting

- Breaks "unreadable date" regression test for unknown reason

* Properly colorize tags and print body

* Reformatting and clean up

* Replace list comprehension with generator

* Handle invalid colors by not using a color

* Process ANSI escapes properly with behave

* Fixed the 'spaces after tags directly next to punctuation' bug

Broke processing of tags next to any punctuation at all

* Closer to working tag colorization but not perfect

* Add tests printing for multiline journals

Fix #717

* Correctly indent first line of multiline entry

* Add test for multiline entries with tags

* Remove redundant UNICODE flag

* Progress towards proper tag colorization and body formatting

* Fix newline colorization bug

Debug code left intact since there are more bugs to fix :/

* And now the space just ends up before the tag instead of after it

* Fix assertion syntax warning

* Moved tag test to tagging.feature file

* Strip out debug code and clean up

* Bold datetimes in title

* Bold all titles

Fix #720

* Remove PY2 and PY3 constants

* Fix regression in features/steps/core.py

* Fix tag_regex

* Remove redundant re.UNICODE flag

* Remove extraneous code
2020-04-10 11:51:56 -07:00
Craig Moyer
a3c81d46fe Add support for folder base journal.
Adds feature for issue #170 (and #398) where you configure your journal to
be a directory and entries are added as sub-directories and files:
yyyy/mm/dd.txt. Multiple entries in a day will go in the same file, but a
new entry for a specific day will create a new file (and directory
structure).

Fix failed test scenarios for folder journal.
2020-04-10 11:51:56 -07:00
MinchinWeb
cec0beff9a Listing all entries in DayOne Classic journal throws IndexError (#786)
* Reproduce bug in #780
🎵 I have no body, no body to love me... 🎵
The bug is cause by a DayOne entry that has to entry body.

* Deal with empty bodies
Close #780.

* [Travis-CI] add "tree" command to debug missing files
* Fix file location
I have no idea why, but it ran locally fine without issue. Travis is more particular...
2020-04-10 11:51:56 -07:00
Peter Schmidbauer
9664924096 Move all password handling to EncryptedJournal
This commit should greatly simplify all password handling logic. No passwords are stored in the config dict anymore. Only the Encrypted Journals have any password related logic. I also had to remove some password fields from the test files, which shows how dangerous the previous approach was. A slight code change could've leaked passwords to the config file. However, I had to change the install progress a little bit to make this work. It will now not ask you for a password right away but rather if you want to encrypt or not. Only if you reply 'y' will it ask you for the password later on.
2020-04-10 11:51:56 -07:00
Aaron Lichtman
1fd1fcc00d Exit jrnl if no text entered into editor
Add test for aborting jrnl entry from editor
Use native mocking
Add comment explaining discrepancy between expected and asserted output
Fix check_empty_output method
Check message on stderr and patch subprocess.call
Add _mock_editor_function
Update features/steps/core.py
Add return from mock function
Add debug statements
Debug
Update features/steps/core.py
Move sys.exit() down
Fix test?
Fix test?
Fix test?
Clean up debug statements
Clean up debug statements
Remove extraneous code
Remove extra space
Add test for empty stdin input
Remove extra debug line
Fix test?
Fix test?
Update features/core.feature
Fix test?
Fix no stdin input test

Co-Authored-By: pspeter <peter.schmidb@gmail.com>
2020-04-10 11:51:55 -07:00
Peter Schmidbauer
7f46d1a40a Fix handling of little-endian date format
Ever since version 2.0, when parsing a journal file, jrnl would not use
the custom date format string anymore. Instead, it relied on the
dateutil library to get the parsing right. This change was made to allow
people to change their date format without having to manually change
their file. However, this broke some existing date formats like
%d.%m.%Y, as it would falsely interpret the month as day and vice versa.
This commit adds some tests to catch this error and fixes it by trying
to parse the dates using the custom format first, only falling back to
dateutil when needed.
2020-04-10 11:51:55 -07:00
Greg Bodnar
623fa6c307 Create encrypted journal
Add failing test for configuring an encrypted journal
Overload open for EncryptedJournal

This avoids the execution path that calls EncryptedJournal._create()
without a password parameter. It results in duplication of code that
requests and stores a password, which should be factored out in a
subsequent change.

Modify test to test for returned strings

The entered string for the password is not being used by the test and I
don't understand why.

Use util wrapper for getpass

This allows for tests to run without prompting for user input.
2020-04-10 11:51:55 -07:00
Jonathan Wren
b260ff35b9 #631 Escape data in square brackets 2020-04-10 11:51:55 -07:00
Micah Jerome Ellison
f37f82f782 [GH-614] resolving issues around unreadable dates and unparsed dates 2020-04-10 11:51:55 -07:00
Manuel Ebert
60a955de20 Template exporting FTW 2016-08-19 23:20:31 +00:00
Philip Douglass
ba05411a80 User defined indent character (#419)
Make indent character configurable.
2016-04-15 23:00:49 -07:00
flight16
28d87861cc Merged PR 2015-12-28 21:36:17 -08:00
Manuel Ebert
4adb5c252a Update tests for templates 2015-07-01 22:23:13 -07:00
Manuel Ebert
0d1b381bd1 Merge pull request #347 from MinchinWeb/2.0-rc1-markdown-export-fix
2.0 rc1 markdown export fix
2015-04-20 14:29:17 +02:00
Manuel Ebert
9bf4e52b2c Tests for #343 2015-04-20 14:25:20 +02:00
MinchinWeb
f1a83a51ed Add testing for increasing Headings on Markdown export 2015-04-14 15:13:00 -06:00
Manuel Ebert
539a88ed14 Tests for parsing issue fix 2015-04-05 18:38:37 +02:00
Manuel Ebert
6e52b5eb70 Tests for #333 2015-04-05 03:27:09 +04:00
Manuel Ebert
c508e0c574 Update all tests to new time format 2015-04-05 03:25:39 +04:00
Manuel Ebert
2615070df0 Hardcoded salt to fix crypto 2015-04-04 17:50:44 +11:00
Manuel Ebert
a1b5a4099e Work on cryptography 2014-09-27 13:15:46 -07:00
Manuel Ebert
e75e3d73a0 Converts tests to YAML 2014-09-12 15:28:12 -07:00
Manuel Ebert
60c03d96d6 Fixes config tests 2014-09-12 14:22:45 -07:00
U-NA\cle1413
e0fb621110 Add assertion to scenario that verifies a tag on a new line is recoginized as a tag. 2014-07-23 11:19:47 -04:00
Matt Hoffman
d5142a0a0a There should be a whitespace character in front of a tag. Fixes issue #237. 2014-07-22 22:14:26 -04:00
Manuel Ebert
88d4c52568 Tests for tagging 2014-07-02 15:35:05 +02:00
Manuel Ebert
9265c3f850 Fixes xml header 2014-05-22 13:24:04 -07:00
Manuel Ebert
09066ee64d Fix encoding in tests 2014-05-22 12:16:26 -07:00
Manuel Ebert
91de932568 Tests for ignoring invalid DayOne entries 2014-04-16 14:35:03 -04:00
Manuel Ebert
00f122ed1a Tests for #153 2014-04-16 14:26:02 -04:00
Manuel Ebert
cabbbea694 Tests for fixing errors automatically 2013-11-03 14:38:41 -10:00
Manuel Ebert
49a540dbbf Tests for soft-deprecating passwords in config 2013-10-20 13:43:04 -07:00
Manuel Ebert
13b7d1c1df Tests for storing password in keychain 2013-10-17 16:26:49 -07:00
Manuel Ebert
c6c425093e Remove tests for having password in config 2013-10-17 16:00:45 -07:00
Manuel Ebert
974f5a0f9c Adds empty folder for testing 2013-08-28 13:37:18 -07:00
Manuel Ebert
1bab646c09 Tests for error messages on empty directories 2013-08-28 12:18:58 -07:00
Manuel Ebert
2a981d51e2 Tests for parsing DayOne entries without Timezone 2013-08-17 13:19:54 -07:00
Manuel Ebert
0fa981357e Initial support for DayOne integration testing 2013-08-17 11:59:51 -07:00
Manuel Ebert
d4cb4e64f6 Tests for filtering 2013-08-06 17:57:31 -07:00
Manuel Ebert
1dfbfc2eaa Tests for tagging 2013-07-23 21:02:03 -07:00
Manuel Ebert
19f6fd3672 Test for decrypting journals when password is saved in config 2013-07-22 21:26:21 +02:00
Manuel Ebert
dbf5caa971 Changes cleaning strategy 2013-07-22 21:19:30 +02:00