Added tests and updated README
Added: Test for running notify-send when declaring success icon Added: Config information to README Note: With the way the tests are currently structured, I couldn't find a way to test the failure icon. I'm not an expert in zunit so there may be a way that I can't find
This commit is contained in:
parent
2c0059707f
commit
f405233080
2 changed files with 26 additions and 0 deletions
11
README.rst
11
README.rst
|
@ -162,6 +162,17 @@ then all the values in ``AUTO_NOTIFY_IGNORE`` are not used.
|
|||
|
||||
export AUTO_NOTIFY_WHITELIST=("apt-get" "docker")
|
||||
|
||||
**Adding an icon - Linux**
|
||||
|
||||
If you wish to have an icon displayed on command success and/or failure, you can do so by defining the environmental variables ``AUTO_NOTIFY_ICON_SUCCESS`` and ``AUTO_NOTIFY_ICON_FAILURE`` respectively.
|
||||
|
||||
::
|
||||
|
||||
export AUTO_NOTIFY_ICON_SUCCESS=/path/to/success/icon.png
|
||||
export AUTO_NOTIFY_ICON_FAILURE=/path/to/failure/icon.png
|
||||
|
||||
|
||||
|
||||
Temporarily Disabling Notifications
|
||||
-----------------------------------
|
||||
|
||||
|
|
|
@ -92,6 +92,21 @@
|
|||
assert "$lines[4]" same_as "--app-name=zsh --hint=int:transient:1 --urgency=normal --expire-time=15000"
|
||||
}
|
||||
|
||||
@test 'auto-notify-send sends notification and icon on Linux on success' {
|
||||
AUTO_COMMAND="f bar -r"
|
||||
AUTO_COMMAND_FULL="foo bar -r"
|
||||
AUTO_COMMAND_START=11080
|
||||
AUTO_NOTIFY_EXPIRE_TIME=15000
|
||||
AUTO_NOTIFY_ICON_SUCCESS=/path/to/success/icon.png
|
||||
run _auto_notify_send
|
||||
|
||||
assert $state equals 0
|
||||
assert "$lines[1]" same_as 'Notification Title: "f bar -r" Completed'
|
||||
assert "$lines[2]" same_as "Notification Body: Total time: 20 seconds"
|
||||
assert "$lines[3]" same_as "Exit code: 0"
|
||||
assert "$lines[4]" same_as "--app-name=zsh --hint=int:transient:1 --urgency=normal --expire-time=15000 --icon=/path/to/success/icon.png"
|
||||
}
|
||||
|
||||
@test 'auto-notify-send sends notification on macOS' {
|
||||
AUTO_COMMAND="f bar -r"
|
||||
AUTO_COMMAND_FULL="foo bar -r"
|
||||
|
|
Loading…
Add table
Reference in a new issue