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

Function TestSendDirectMacOS

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

Source from the content-addressed store, hash-verified

414}
415
416func TestSendDirectMacOS(t *testing.T) {
417 c := New()
418 defer c.Close()
419 c.Init(&logic.Options{DBUrl: "sqlite://?mode=memory", Registerable: true}) // nolint: errcheck
420 tk, _ := model.ParseToken("EiJBQk9PNlRTSVhLU0VWSUpLWExEUVNVWFFSWFVBT1hHR1lZIgRjaGFuKgVNRlJHRw..c2lnbg") // nolint: errcheck
421 w := httptest.NewRecorder()
422 ctx, _ := gin.CreateTestContext(w)
423 ctx.Request, _ = http.NewRequest("GET", "", nil)
424 c.logic.UpsertUser("ABOO6TSIXKSEVIJKXLDQSUXQRXUAOXGGYY", "BGaP1ekObDB0bRkmvxkvfFXCLSk46mO7rW8PikP8sWsA_97yij0s0U7ioA9dWEoz41TrUP8Z88XzQ_Tl8AOoJF4", false) // nolint: errcheck // nolint: errcheck
425 c.logic.BindDevice("ABOO6TSIXKSEVIJKXLDQSUXQRXUAOXGGYY", "B3BC1B875EDA13986801B1004B4ABF5760C197F4", "BDuFNLkmxyK0-NN3H3oKzzOtISq1w17-JAibD7X4pljYl6IEaEglWkKD5Iw537h-DYxAooXkHtu6un078sm7IiQ", 3) // nolint: errcheck
426 c.logic.UpdatePushToken("ABOO6TSIXKSEVIJKXLDQSUXQRXUAOXGGYY", "B3BC1B875EDA13986801B1004B4ABF5760C197F4", "aGVsbG8", false) // nolint: errcheck // nolint: errcheck
427 c.logic.GetDevices("ABOO6TSIXKSEVIJKXLDQSUXQRXUAOXGGYY") // nolint: errcheck
428 logic.MockPusher = &MockAPNSPusher{}
429 c.sendDirect(ctx, tk, model.NewMessage(tk).SetPriority(5))
430 if w.Result().StatusCode != http.StatusOK {
431 t.Fatal("Send direct failed")
432 }
433}
434
435func TestSendForward(t *testing.T) {
436 logic.APIEndpoint = "http://127.0.0.1"

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected