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

@ -46,7 +46,7 @@ Feature: Writing new entries.
Given we use the config "<config_file>"
And we use the password "bad doggie no biscuit" if prompted
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"
Then the output should contain "Entry added"
When we run "jrnl -n 1"
Then the output should contain "2013-07-23 09:00 A cold and stormy day."
@ -61,7 +61,7 @@ Feature: Writing new entries.
Given we use the config "<config_file>"
And we use the password "test" if prompted
When we run "jrnl this is a partial --edit"
Then we should see the message "Entry added"
Then the output should contain "Entry added"
Then the editor should have been called
And the editor file content should be
this is a partial
@ -110,7 +110,7 @@ Feature: Writing new entries.
Given we use the config "<config_file>"
And we use the password "bad doggie no biscuit" if prompted
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"
Then the output should contain "Entry added"
When we run "jrnl -n 1"
Then the output should not contain "Life is good"
@ -125,7 +125,7 @@ Feature: Writing new entries.
Given we use the config "<config_file>"
And we use the password "bad doggie no biscuit" if prompted
When we run "jrnl 04-24-2014: Created a new website - empty.com. Hope to get a lot of traffic."
Then we should see the message "Entry added"
Then the output should contain "Entry added"
When we run "jrnl -1"
Then the output should be
2014-04-24 09:00 Created a new website - empty.com.
@ -142,7 +142,7 @@ Feature: Writing new entries.
Given we use the config "<config_file>"
And we use the password "bad doggie no biscuit" if prompted
When we run "jrnl 23 july 2013: 🌞 sunny day. Saw an 🐘"
Then we should see the message "Entry added"
Then the output should contain "Entry added"
When we run "jrnl -n 1"
Then the output should contain "🌞"
And the output should contain "🐘"
@ -199,7 +199,7 @@ Feature: Writing new entries.
Scenario: Title with an embedded period on DayOne journal
Given we use the config "dayone.yaml"
When we run "jrnl 04-24-2014: Ran 6.2 miles today in 1:02:03. I am feeling sore because I forgot to stretch."
Then we should see the message "Entry added"
Then the output should contain "Entry added"
When we run "jrnl -1"
Then the output should be
2014-04-24 09:00 Ran 6.2 miles today in 1:02:03.
@ -208,7 +208,7 @@ Feature: Writing new entries.
Scenario: Opening an folder that's not a DayOne folder should treat as folder journal
Given we use the config "empty_folder.yaml"
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 -1"
Then the output should be "2013-07-23 09:00 Testing folder journal."