mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-12-14 11:47:33 +00:00
Changelog, add tests
This commit is contained in:
parent
58bde32bfb
commit
8f4a1db1f0
2 changed files with 66 additions and 1 deletions
|
@ -8,7 +8,10 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release
|
|||
|
||||
**Features:**
|
||||
|
||||
* Support for ntfy:// deep links ([#20](https://github.com/binwiederhier/ntfy/issues/20), thanks to [@Copephobia](https://github.com/Copephobia) for reporting)
|
||||
* Custom notification [action buttons](https://ntfy.sh/docs/publish/#action-buttons) ([#134](https://github.com/binwiederhier/ntfy/issues/134),
|
||||
thanks to [@mrherman](https://github.com/mrherman) for reporting)
|
||||
* Support for [ntfy:// deep links](https://ntfy.sh/docs/subscribe/phone/#ntfy-links) ([#20](https://github.com/binwiederhier/ntfy/issues/20), thanks
|
||||
to [@Copephobia](https://github.com/Copephobia) for reporting)
|
||||
* [Fastlane metadata](https://hosted.weblate.org/projects/ntfy/android-fastlane/) can now be translated too ([#198](https://github.com/binwiederhier/ntfy/issues/198),
|
||||
thanks to [@StoyanDimitrov](https://github.com/StoyanDimitrov) for reporting)
|
||||
* Channel settings option to configure DND override, sounds, etc. ([#91](https://github.com/binwiederhier/ntfy/issues/91))
|
||||
|
@ -26,10 +29,17 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release
|
|||
* Japanese (thanks to [@shak](https://hosted.weblate.org/user/shak/))
|
||||
* Russian (thanks to [@flamey](https://hosted.weblate.org/user/flamey/) and [@ilya.mikheev.coder](https://hosted.weblate.org/user/ilya.mikheev.coder/))
|
||||
|
||||
**Thanks for testing:**
|
||||
|
||||
Thanks to [@RasHas](https://github.com/RasHas) (aka @Shard), [@Fallenbagel](https://github.com/Fallenbagel), [@cmeis](https://github.com/cmeis),
|
||||
@poblabs, and everyone I forgot for testing.
|
||||
|
||||
## ntfy server v1.21.0 (UNRELEASED)
|
||||
|
||||
**Features:**
|
||||
|
||||
* Custom notification [action buttons](https://ntfy.sh/docs/publish/#action-buttons) ([#134](https://github.com/binwiederhier/ntfy/issues/134),
|
||||
thanks to [@mrherman](https://github.com/mrherman) for reporting)
|
||||
* Added ARMv6 build ([#200](https://github.com/binwiederhier/ntfy/issues/200), thanks to [@jcrubioa](https://github.com/jcrubioa) for reporting)
|
||||
* Web app internationalization support ([#189](https://github.com/binwiederhier/ntfy/issues/189))
|
||||
|
||||
|
|
|
@ -876,6 +876,26 @@ func TestServer_PublishUnifiedPushText(t *testing.T) {
|
|||
require.Equal(t, "this is a unifiedpush text message", m.Message)
|
||||
}
|
||||
|
||||
func TestServer_PublishActions_AndPoll(t *testing.T) {
|
||||
s := newTestServer(t, newTestConfig(t))
|
||||
response := request(t, s, "PUT", "/mytopic", "my message", map[string]string{
|
||||
"Actions": "view, Open portal, https://home.nest.com/; http, Turn down, https://api.nest.com/device/XZ1D2, body=target_temp_f=65",
|
||||
})
|
||||
require.Equal(t, 200, response.Code)
|
||||
|
||||
response = request(t, s, "GET", "/mytopic/json?poll=1", "", nil)
|
||||
require.Equal(t, 200, response.Code)
|
||||
m := toMessage(t, response.Body.String())
|
||||
require.Equal(t, 2, len(m.Actions))
|
||||
require.Equal(t, "view", m.Actions[0].Action)
|
||||
require.Equal(t, "Open portal", m.Actions[0].Label)
|
||||
require.Equal(t, "https://home.nest.com/", m.Actions[0].URL)
|
||||
require.Equal(t, "http", m.Actions[1].Action)
|
||||
require.Equal(t, "Turn down", m.Actions[1].Label)
|
||||
require.Equal(t, "https://api.nest.com/device/XZ1D2", m.Actions[1].URL)
|
||||
require.Equal(t, "target_temp_f=65", m.Actions[1].Body)
|
||||
}
|
||||
|
||||
func TestServer_PublishAsJSON(t *testing.T) {
|
||||
s := newTestServer(t, newTestConfig(t))
|
||||
body := `{"topic":"mytopic","message":"A message","title":"a title\nwith lines","tags":["tag1","tag 2"],` +
|
||||
|
@ -911,6 +931,41 @@ func TestServer_PublishAsJSON_WithEmail(t *testing.T) {
|
|||
require.Equal(t, 1, mailer.Count())
|
||||
}
|
||||
|
||||
func TestServer_PublishAsJSON_WithActions(t *testing.T) {
|
||||
s := newTestServer(t, newTestConfig(t))
|
||||
body := `{
|
||||
"topic":"mytopic",
|
||||
"message":"A message",
|
||||
"actions": [
|
||||
{
|
||||
"action": "view",
|
||||
"label": "Open portal",
|
||||
"url": "https://home.nest.com/"
|
||||
},
|
||||
{
|
||||
"action": "http",
|
||||
"label": "Turn down",
|
||||
"url": "https://api.nest.com/device/XZ1D2",
|
||||
"body": "target_temp_f=65"
|
||||
}
|
||||
]
|
||||
}`
|
||||
response := request(t, s, "POST", "/", body, nil)
|
||||
require.Equal(t, 200, response.Code)
|
||||
|
||||
m := toMessage(t, response.Body.String())
|
||||
require.Equal(t, "mytopic", m.Topic)
|
||||
require.Equal(t, "A message", m.Message)
|
||||
require.Equal(t, 2, len(m.Actions))
|
||||
require.Equal(t, "view", m.Actions[0].Action)
|
||||
require.Equal(t, "Open portal", m.Actions[0].Label)
|
||||
require.Equal(t, "https://home.nest.com/", m.Actions[0].URL)
|
||||
require.Equal(t, "http", m.Actions[1].Action)
|
||||
require.Equal(t, "Turn down", m.Actions[1].Label)
|
||||
require.Equal(t, "https://api.nest.com/device/XZ1D2", m.Actions[1].URL)
|
||||
require.Equal(t, "target_temp_f=65", m.Actions[1].Body)
|
||||
}
|
||||
|
||||
func TestServer_PublishAsJSON_Invalid(t *testing.T) {
|
||||
s := newTestServer(t, newTestConfig(t))
|
||||
body := `{"topic":"mytopic",INVALID`
|
||||
|
|
Loading…
Reference in a new issue