Remove unneeded exception when editor is empty and fix test that was testing incorrect message

This commit is contained in:
Micah Jerome Ellison 2023-02-18 13:28:31 -08:00 committed by Jonathan Wren
parent 2e06e3d4eb
commit 1873f69ded
2 changed files with 8 additions and 11 deletions

View file

@ -44,9 +44,6 @@ def get_text_from_editor(config: dict, template: str = "") -> str:
raw = f.read() raw = f.read()
os.remove(tmpfile) os.remove(tmpfile)
if not raw:
raise JrnlException(Message(MsgText.NoTextReceived, MsgStyle.NORMAL))
return raw return raw

View file

@ -78,19 +78,19 @@ Feature: Writing new entries.
Scenario Outline: Writing an empty entry from the editor should yield "No entry to save" message Scenario Outline: Writing an empty entry from the editor should yield "No entry to save" message
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we write nothing to the editor if opened And we append nothing to the editor if opened
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --edit" When we run "jrnl --edit"
Then the error output should contain "No entry to save, because no text was received" Then the error output should contain "No edits to save, because nothing was changed"
And the editor should have been called And the editor should have been called
Examples: configs Examples: configs
| config_file | | config_file |
| editor.yaml | | editor.yaml |
| editor_empty_folder.yaml | | basic_onefile.yaml |
| dayone.yaml | | basic_encrypted.yaml |
| basic_encrypted.yaml | | basic_dayone.yaml |
| basic_onefile.yaml | | basic_folder.yaml |
Scenario Outline: Writing an empty entry from the command line should yield "No entry to save" message Scenario Outline: Writing an empty entry from the command line should yield "No entry to save" message
Given we use the config "<config_file>" Given we use the config "<config_file>"