Notifications with new Flutter app [Kinda work!]
All checks were successful
Build Docker and Deploy / Build Docker Container (push) Successful in 1m56s
Build Docker and Deploy / Deploy to Server (push) Successful in 5s

This commit is contained in:
2024-06-01 15:37:59 +02:00
parent 0560330f68
commit e397f009b9
19 changed files with 198 additions and 551 deletions

View File

@@ -704,44 +704,6 @@ func TestCompatRequery(t *testing.T) {
}
func TestCompatTitlePatch(t *testing.T) {
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
defer stop()
pusher := ws.Pusher.(*push.TestSink)
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/v2/users", gin.H{
"agent_model": "DUMMY_PHONE",
"agent_version": "4X",
"client_type": "ANDROID",
"fcm_token": "DUMMY_FCM",
})
uid := r0["user_id"].(string)
admintok := r0["admin_key"].(string)
sendtok := r0["send_key"].(string)
type clientlist struct {
Clients []gin.H `json:"clients"`
}
clist1 := tt.RequestAuthGet[clientlist](t, admintok, baseUrl, fmt.Sprintf("/api/v2/users/%s/clients", url.QueryEscape(uid)))
tt.SetCompatClient(t, ws, clist1.Clients[0]["client_id"].(string))
_ = tt.RequestPost[gin.H](t, baseUrl, "/", gin.H{
"key": sendtok,
"user_id": uid,
"title": "HelloWorld_001",
"channel": "TestChan",
})
tt.AssertEqual(t, "messageCount", 1, len(pusher.Data))
tt.AssertStrRepEqual(t, "msg.title", "HelloWorld_001", pusher.Last().Message.Title)
tt.AssertStrRepEqual(t, "msg.ovrTitle", "[TestChan] HelloWorld_001", pusher.Last().CompatTitleOverride)
}
func TestCompatAckCount(t *testing.T) {
_, baseUrl, stop := tt.StartSimpleWebserver(t)
defer stop()

View File

@@ -2,7 +2,6 @@ package util
import (
"blackforestbytes.com/simplecloudnotifier/logic"
"gogs.mikescher.com/BlackForestBytes/goext/sq"
"testing"
"time"
)
@@ -65,14 +64,3 @@ func CreateCompatID(t *testing.T, ws *logic.Application, idtype string, newid st
return uidold
}
func SetCompatClient(t *testing.T, ws *logic.Application, cid string) {
ctx := ws.NewSimpleTransactionContext(5 * time.Second)
defer ctx.Cancel()
_, err := ws.Database.Primary.DB().Exec(ctx, "INSERT INTO compat_clients (client_id) VALUES (:cid)", sq.PP{"cid": cid})
TestFailIfErr(t, err)
err = ctx.CommitTransaction()
TestFailIfErr(t, err)
}