Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of test refactoring #1042

Merged
merged 52 commits into from Oct 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
6b73eb7
make behave slightly less verbose for use with behave --format progress2
wren Jul 5, 2020
131477c
standardize behave tests
wren Jul 7, 2020
3c10766
clean up txt file after tests
wren Jul 5, 2020
b0be986
add more tests, add more functionality to behave for calling mock editor
wren Sep 5, 2020
764227d
move around behave tests, get rid of regression files
wren Sep 5, 2020
6ada26d
clean up some code around keyrings, clean up more tests
wren Sep 6, 2020
78d362e
take out old test
wren Sep 6, 2020
1d11f3d
More test shuffling
wren Sep 6, 2020
e3f3904
rename files
wren Sep 19, 2020
80bc2ae
move tests to be more behavior driven
wren Sep 19, 2020
d1692ab
move tests to be more behavior driven
wren Sep 19, 2020
607aa7a
move tests to be more behavior driven
wren Sep 19, 2020
a6b646b
Add write tests for each journal type
micahellison Sep 19, 2020
899dd50
update version tests, add new regex match behave step
wren Sep 19, 2020
4094175
add config test outlines
wren Sep 19, 2020
e5c1114
Add tests for starring with various journal types
micahellison Sep 19, 2020
379a63c
update datetime tests
wren Sep 20, 2020
66b9f5a
Standardize and clean up star and write features
micahellison Sep 25, 2020
2ac8f61
Add journal types to some search tests
micahellison Sep 25, 2020
69c0f5e
rename files, add some basic journals for each journal type
wren Sep 25, 2020
f740145
Merge branch 'moar-tests' of https://github.com/wren/jrnl into moar-t…
micahellison Sep 25, 2020
56a7cc9
Change "basic" config reference to "simple"
micahellison Sep 25, 2020
777f69e
update configs
wren Sep 25, 2020
8c9dce4
Add more journal types in search
micahellison Sep 25, 2020
7baec00
Merge branch 'moar-tests' of https://github.com/wren/jrnl into moar-t…
micahellison Sep 25, 2020
bb5f7a8
Fix basic folder journal reference
micahellison Sep 25, 2020
242467d
add flush output steps to behave, update delete flag tests
wren Sep 25, 2020
5d9fe76
Add search tests so far (broken)
micahellison Sep 25, 2020
ea51fc5
Merge branch 'moar-tests' of https://github.com/wren/jrnl into moar-t…
micahellison Sep 25, 2020
0e42187
Fix failing test with a flush
micahellison Sep 25, 2020
590e051
update more delete flag tests to include other journal types
wren Sep 25, 2020
eb9b679
update more delete flag tests to include other journal types
wren Sep 26, 2020
4df0aef
fix file cleanup after failed test with no debug on
wren Sep 26, 2020
1e160c5
add more password tests
wren Sep 26, 2020
694c8cd
clean up linting issues
wren Sep 26, 2020
03c1304
fix password test
wren Sep 26, 2020
54eaeb0
oops whitespace error
wren Sep 26, 2020
932996a
Fix DayOne tag sample data, move search/format tag tests, and run the…
micahellison Sep 26, 2020
fda3fe2
Merge branch 'moar-tests' of https://github.com/wren/jrnl into moar-t…
micahellison Sep 26, 2020
cf369f3
Added ability to auto-prompt for password for encrypted journals
wren Sep 26, 2020
af05040
Fold encrypted scenarios into the rest of the scenarios where possible
micahellison Sep 26, 2020
7b2e35c
Remove apostrophe that is breaking tests on CI
micahellison Sep 26, 2020
8483d36
add more journal type tests to import feature
wren Sep 27, 2020
9116b63
standardize whitespace in behave tests, take out duplicate test
wren Sep 27, 2020
7368cd6
update more tests
wren Oct 11, 2020
93f383c
update behave step to be more clear
wren Oct 11, 2020
11c7a87
update handling of cache directories in test suite (easier syntax)
wren Oct 11, 2020
4702e6c
Skip failing YAML exporter emoji test on Windows
micahellison Oct 17, 2020
6df0db1
troubleshooting windows test failures on travis
wren Oct 17, 2020
b438f58
troubleshooting windows test failures on travis
wren Oct 17, 2020
b006452
troubleshooting windows test failures on travis
wren Oct 17, 2020
3772ff3
troubleshooting windows test failures on travis
wren Oct 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions features/build.feature
@@ -0,0 +1,8 @@
Feature: Build process

@deployment_tests
Scenario: Version numbers should stay in sync
Given we use the config "simple.yaml"
When we run "jrnl --version"
Then we should get no error
And the output should contain pyproject.toml version
29 changes: 0 additions & 29 deletions features/contains.feature

This file was deleted.

200 changes: 10 additions & 190 deletions features/core.feature
@@ -1,201 +1,21 @@
Feature: Basic reading and writing to a journal
Feature: Functionality of jrnl outside of actually handling journals

Scenario: Loading a sample journal
Given we use the config "basic.yaml"
When we run "jrnl -n 2"
Then we should get no error
and the output should be
"""
2013-06-09 15:39 My first entry.
| Everything is alright

2013-06-10 15:40 Life is good.
| But I'm better.
"""

Scenario: Printing a journal that has multiline entries
Given we use the config "multiline.yaml"
When we run "jrnl -n 1"
Then we should get no error
and the output should be
"""
2013-06-09 15:39 Multiple line entry.
| This is the first line.
| This line doesn't have any ending punctuation
|
| There is a blank line above this.
"""

Scenario: Multiline entry with punctuation
Given we use the config "basic.yaml"
When we run "jrnl This is. the title\\n This is the second line"
and we run "jrnl -n 1"
Then the output should contain "This is. the title"

Scenario: Single line entry with punctuation
Given we use the config "basic.yaml"
When we run "jrnl This is. the title"
and we run "jrnl -n 1"
Then the output should contain "| the title"

Scenario: Writing an entry from command line
Given we use the config "basic.yaml"
When we run "jrnl 23 july 2013: A cold and stormy day. I ate crisps on the sofa."
Then we should see the message "Entry added"
When we run "jrnl -n 1"
Then the output should contain "2013-07-23 09:00 A cold and stormy day."

Scenario: Writing an empty entry from the editor
Given we use the config "editor.yaml"
When we open the editor and enter nothing
Then we should see the message "[Nothing saved to file]"

Scenario: Sending an argument with spaces to the editor should work
Given we use the config "editor-args.yaml"
When we open the editor and enter "lorem ipsum"
Then the editor should have been called with 5 arguments
And one editor argument should be "vim"
And one editor argument should be "-f"
And one editor argument should be "-c"
And one editor argument should match "'?setf markdown'?"

Scenario: Writing an empty entry from the command line
Given we use the config "basic.yaml"
When we run "jrnl" and enter nothing
Then the output should be
"""

"""

Scenario: Filtering for dates
Given we use the config "basic.yaml"
When we run "jrnl -on 2013-06-10 --short"
Then the output should be "2013-06-10 15:40 Life is good."
When we run "jrnl -on 'june 6 2013' --short"
Then the output should be "2013-06-10 15:40 Life is good."

Scenario: Emoji support
Given we use the config "basic.yaml"
When we run "jrnl 23 july 2013: 🌞 sunny day. Saw an 🐘"
Then we should see the message "Entry added"
When we run "jrnl -n 1"
Then the output should contain "🌞"
and the output should contain "🐘"

Scenario: Writing an entry at the prompt
Given we use the config "basic.yaml"
When we run "jrnl" and enter "25 jul 2013: I saw Elvis. He's alive."
Scenario: Displaying the version number
Given we use the config "simple.yaml"
When we run "jrnl --version"
Then we should get no error
and the journal should contain "[2013-07-25 09:00] I saw Elvis."
and the journal should contain "He's alive."
Then the output should match "^jrnl version v\d+\.\d+\.\d+(-(alpha|beta))?$"

Scenario: Displaying the version number
Given we use the config "basic.yaml"
Given we use the config "simple.yaml"
When we run "jrnl -v"
Then we should get no error
Then the output should contain "version"

Scenario: --short displays the short version of entries (only the title)
Given we use the config "basic.yaml"
When we run "jrnl -on 2013-06-10 --short"
Then the output should be "2013-06-10 15:40 Life is good."

Scenario: -s displays the short version of entries (only the title)
Given we use the config "basic.yaml"
When we run "jrnl -on 2013-06-10 -s"
Then the output should be "2013-06-10 15:40 Life is good."

Scenario: Invalid color configuration
Given we use the config "invalid_color.yaml"
When we run "jrnl -on 2013-06-10 -s"
Then the output should be
"""
2013-06-10 15:40 Life is good.
"""
And we should get no error

Scenario: Journal directory does not exist
Given we use the config "missing_directory.yaml"
When we run "jrnl Life is good"
and we run "jrnl -n 1"
Then the output should contain "Life is good"

Scenario: Installation with relative journal and referencing from another folder
Given we use the config "missingconfig"
When we run "jrnl hello world" and enter
"""
test.txt
n
"""
and we change directory to "features"
and we run "jrnl -n 1"
Then the output should contain "hello world"
Then the output should match "^jrnl version v\d+\.\d+\.\d+(-(alpha|beta))?$"

Scenario: --diagnostic runs without exceptions
Scenario: Running the diagnostic command
When we run "jrnl --diagnostic"
Then the output should contain "jrnl"
And the output should contain "Python"

Scenario: --import allows new entry from stdin
Given we use the config "basic.yaml"
When we run "jrnl --import" and pipe "[2020-07-05 15:00] Observe and import."
And we run "jrnl -1"
Then the journal should contain "[2020-07-05 15:00] Observe and import."
And the output should contain "Observe and import"

Scenario: --import allows new large entry from stdin
Given we use the config "basic.yaml"
When we run "jrnl --import" and pipe
"""
[2020-07-05 15:00] Observe and import.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada quis
est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque augue
et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu consequat.
Aenean ante ex, elementum ut interdum et, mattis eget lacus. In commodo nulla nec
tellus placerat, sed ultricies metus bibendum. Duis eget venenatis erat. In at
dolor dui end of entry.
"""
And we run "jrnl -1"
Then the journal should contain "[2020-07-05 15:00] Observe and import."
And the output should contain "Observe and import"
And the output should contain "Lorem ipsum"
And the output should contain "end of entry."

Scenario: --import allows multiple new entries from stdin
Given we use the config "basic.yaml"
When we run "jrnl --import" and pipe
"""
[2020-07-05 15:00] Observe and import.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

[2020-07-05 15:01] Twice as nice.
Sed dignissim sed nisl eu consequat.
"""
Then the journal should contain "[2020-07-05 15:00] Observe and import."
Then the journal should contain "[2020-07-05 15:01] Twice as nice."

Scenario: --import allows import new entries from file
Given we use the config "basic.yaml"
Then the journal should contain "My first entry."
And the journal should contain "Life is good."
But the journal should not contain "I have an @idea"
And the journal should not contain "I met with"
When we run "jrnl --import --file features/journals/tags.journal"
Then the journal should contain "My first entry."
And the journal should contain "Life is good."
And the journal should contain "PROFIT!"

Scenario: --import doesn't get confused with piping and file
Given we use the config "basic.yaml"
Then the journal should contain "My first entry."
And the journal should contain "Life is good."
But the journal should not contain "I have an @idea"
And the journal should not contain "I met with"
When we run "jrnl --import --file features/journals/tags.journal" and pipe
"""
[2020-07-05 15:00] I should not exist!
"""
Then the journal should contain "My first entry."
And the journal should contain "PROFIT!"
But the journal should not contain "I should not exist!"

@todo
Scenario: Listing available journals
35 changes: 0 additions & 35 deletions features/custom_dates.feature

This file was deleted.

17 changes: 17 additions & 0 deletions features/data/configs/basic_dayone.yaml
@@ -0,0 +1,17 @@
colors:
date: none
title: none
body: none
tags: none
default_hour: 9
default_minute: 0
editor: noop
encrypt: false
highlight: true
journals:
default: features/journals/basic_dayone.dayone
linewrap: 80
tagsymbols: "@"
template: false
timeformat: "%Y-%m-%d %H:%M"
indent_character: "|"
17 changes: 17 additions & 0 deletions features/data/configs/basic_encrypted.yaml
@@ -0,0 +1,17 @@
colors:
date: none
title: none
body: none
tags: none
default_hour: 9
default_minute: 0
editor: noop
encrypt: true
highlight: true
journals:
default: features/journals/basic_encrypted.journal
linewrap: 80
tagsymbols: "@"
template: false
timeformat: "%Y-%m-%d %H:%M"
indent_character: "|"
17 changes: 17 additions & 0 deletions features/data/configs/basic_folder.yaml
@@ -0,0 +1,17 @@
colors:
date: none
title: none
body: none
tags: none
default_hour: 9
default_minute: 0
editor: noop
encrypt: false
highlight: true
journals:
default: features/journals/basic_folder
linewrap: 80
tagsymbols: "@"
template: false
timeformat: "%Y-%m-%d %H:%M"
indent_character: "|"
17 changes: 17 additions & 0 deletions features/data/configs/basic_onefile.yaml
@@ -0,0 +1,17 @@
colors:
date: none
title: none
body: none
tags: none
default_hour: 9
default_minute: 0
editor: noop
encrypt: false
highlight: true
journals:
default: features/journals/basic_onefile.journal
linewrap: 80
tagsymbols: "@"
template: false
timeformat: "%Y-%m-%d %H:%M"
indent_character: "|"
17 changes: 17 additions & 0 deletions features/data/configs/dayone_empty.yaml
@@ -0,0 +1,17 @@
default_hour: 9
default_minute: 0
editor: noop
template: false
encrypt: false
highlight: true
journals:
default: features/journals/dayone_empty.dayone
linewrap: 80
tagsymbols: '@'
timeformat: '%Y-%m-%d %H:%M'
indent_character: "|"
colors:
date: none
title: none
body: none
tags: none
12 changes: 12 additions & 0 deletions features/data/configs/editor_empty_folder.yaml
@@ -0,0 +1,12 @@
default_hour: 9
default_minute: 0
editor: 'vim'
template: false
encrypt: false
highlight: true
journals:
default: features/journals/empty_folder
linewrap: 80
tagsymbols: '@'
timeformat: '%Y-%m-%d %H:%M'
indent_character: "|"