[Gekidou] Add push notification check to ping (#19610)
* Add push notification check to ping * Add test type and missing details * Address feedback * Fix function name * Address feedback Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7e2ae93231
Коммит
32e3c2f0b8
@@ -183,6 +183,10 @@ func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set(filestoreStatusKey, s[filestoreStatusKey])
|
||||
}
|
||||
|
||||
if deviceID := r.FormValue("device_id"); deviceID != "" {
|
||||
s["CanReceiveNotifications"] = c.App.SendTestPushNotification(deviceID)
|
||||
}
|
||||
|
||||
if s[model.STATUS] != model.StatusOk {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
@@ -96,6 +96,17 @@ func TestGetPing(t *testing.T) {
|
||||
respString = string(respBytes)
|
||||
require.Contains(t, respString, "testvalue")
|
||||
}, "ping feature flag test")
|
||||
|
||||
th.TestForAllClients(t, func(t *testing.T, client *model.Client4) {
|
||||
th.App.ReloadConfig()
|
||||
resp, err := client.DoAPIGet("/system/ping?device_id=platform:id", "")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, http.StatusOK, resp.StatusCode)
|
||||
var respMap map[string]string
|
||||
err = json.NewDecoder(resp.Body).Decode(&respMap)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "unknown", respMap["CanReceiveNotifications"]) // Unrecognized platform
|
||||
}, "ping and test push notification")
|
||||
}
|
||||
|
||||
func TestGetAudits(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user