MCPcopy Create free account
hub / github.com/chanify/chanify / TestSendDirectWatch

Function TestSendDirectWatch

core/sender_test.go:393–414  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

391}
392
393func TestSendDirectWatch(t *testing.T) {
394 c := New()
395 defer c.Close()
396 c.Init(&logic.Options{DBUrl: "sqlite://?mode=memory", Registerable: true}) // nolint: errcheck
397 tk, _ := model.ParseToken("EiJBQk9PNlRTSVhLU0VWSUpLWExEUVNVWFFSWFVBT1hHR1lZIgRjaGFuKgVNRlJHRw..c2lnbg") // nolint: errcheck
398 w := httptest.NewRecorder()
399 ctx, _ := gin.CreateTestContext(w)
400 ctx.Request, _ = http.NewRequest("GET", "", nil)
401 c.logic.UpsertUser("ABOO6TSIXKSEVIJKXLDQSUXQRXUAOXGGYY", "BGaP1ekObDB0bRkmvxkvfFXCLSk46mO7rW8PikP8sWsA_97yij0s0U7ioA9dWEoz41TrUP8Z88XzQ_Tl8AOoJF4", false) // nolint: errcheck // nolint: errcheck
402 c.logic.BindDevice("ABOO6TSIXKSEVIJKXLDQSUXQRXUAOXGGYY", "B3BC1B875EDA13986801B1004B4ABF5760C197F4", "BDuFNLkmxyK0-NN3H3oKzzOtISq1w17-JAibD7X4pljYl6IEaEglWkKD5Iw537h-DYxAooXkHtu6un078sm7IiQ", 2) // nolint: errcheck
403 c.logic.UpdatePushToken("ABOO6TSIXKSEVIJKXLDQSUXQRXUAOXGGYY", "B3BC1B875EDA13986801B1004B4ABF5760C197F4", "aGVsbG8", false) // nolint: errcheck // nolint: errcheck
404 c.logic.GetDevices("ABOO6TSIXKSEVIJKXLDQSUXQRXUAOXGGYY") // nolint: errcheck
405 logic.MockPusher = &MockAPNSPusher{}
406 c.sendDirect(ctx, tk, model.NewMessage(tk).SetPriority(5))
407 if w.Result().StatusCode != http.StatusOK {
408 t.Fatal("Send direct failed")
409 }
410 c.sendDirect(ctx, tk, model.NewMessage(tk).SetPriority(5).SetTimeline(true))
411 if w.Result().StatusCode != http.StatusOK {
412 t.Fatal("Send timeline direct failed")
413 }
414}
415
416func TestSendDirectMacOS(t *testing.T) {
417 c := New()

Callers

nothing calls this directly

Calls 12

ParseTokenFunction · 0.92
NewMessageFunction · 0.92
NewFunction · 0.85
InitMethod · 0.80
sendDirectMethod · 0.80
SetPriorityMethod · 0.80
SetTimelineMethod · 0.80
CloseMethod · 0.65
UpsertUserMethod · 0.65
BindDeviceMethod · 0.65
UpdatePushTokenMethod · 0.65
GetDevicesMethod · 0.65

Tested by

no test coverage detected