Improve handling of mocking logic in pytest (#1382)

* WIP

* fix handling of user input (stdin, input, getpass)

* take out redundant pytest step

* fix handling of 'we should' statements

* fix test that doesn't use a config file

* fix another test that uses stdin

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>

* remove .tool-versions file per PR feedback

* add comment to clarify why disembodied variables are here

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
Jonathan Wren 2021-12-11 12:35:32 -08:00 committed by GitHub
parent 3518e37087
commit 2ab485de8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 259 additions and 197 deletions

View file

@ -3,7 +3,7 @@ Feature: Searching in a journal
Scenario Outline: Displaying entries using -on today should display entries created today
Given we use the config "<config_file>"
When we run "jrnl today: Adding an entry right now."
Then we should see the message "Entry added"
Then the output should contain "Entry added"
When we run "jrnl -on today"
Then the output should contain "Adding an entry right now."
But the output should not contain "Everything is alright"
@ -18,11 +18,11 @@ Feature: Searching in a journal
Scenario Outline: Displaying entries using -from day should display correct entries
Given we use the config "<config_file>"
When we run "jrnl yesterday: This thing happened yesterday"
Then we should see the message "Entry added"
Then the output should contain "Entry added"
When we run "jrnl today at 11:59pm: Adding an entry right now."
Then we should see the message "Entry added"
Then the output should contain "Entry added"
When we run "jrnl tomorrow: A future entry."
Then we should see the message "Entry added"
Then the output should contain "Entry added"
When we run "jrnl -from today"
Then the output should contain "Adding an entry right now."
And the output should contain "A future entry."
@ -37,11 +37,11 @@ Feature: Searching in a journal
Scenario Outline: Displaying entries using -from and -to day should display correct entries
Given we use the config "<config_file>"
When we run "jrnl yesterday: This thing happened yesterday"
Then we should see the message "Entry added"
Then the output should contain "Entry added"
When we run "jrnl today at 11:59pm: Adding an entry right now."
Then we should see the message "Entry added"
Then the output should contain "Entry added"
When we run "jrnl tomorrow: A future entry."
Then we should see the message "Entry added"
Then the output should contain "Entry added"
When we run "jrnl -from yesterday -to today"
Then the output should contain "This thing happened yesterday"
And the output should contain "Adding an entry right now."
@ -118,9 +118,9 @@ Feature: Searching in a journal
Scenario: Out of order entries to a Folder journal should be listed in date order
Given we use the config "empty_folder.yaml"
When we run "jrnl 3/7/2014 4:37pm: Second entry of journal."
Then we should see the message "Entry added"
Then the output should contain "Entry added"
When we run "jrnl 23 July 2013: Testing folder journal."
Then we should see the message "Entry added"
Then the output should contain "Entry added"
When we run "jrnl -2"
Then the output should be
2013-07-23 09:00 Testing folder journal.