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

Function TestSaveFile

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

Source from the content-addressed store, hash-verified

564}
565
566func TestSaveFile(t *testing.T) {
567 fpath := filepath.Join(os.TempDir(), "files")
568 defer os.RemoveAll(fpath)
569 os.MkdirAll(fpath+"/files/", os.ModePerm) // nolint: errcheck
570
571 c := New()
572 defer c.Close()
573 c.Init(&logic.Options{DBUrl: "sqlite://?mode=memory", FilePath: fpath}) // nolint: errcheck
574 w := httptest.NewRecorder()
575 ctx, _ := gin.CreateTestContext(w)
576 tk, _ := model.ParseToken("EiJBQk9PNlRTSVhLU0VWSUpLWExEUVNVWFFSWFVBT1hHR1lZIgRjaGFuKgVNRlJHRzIUx5tXg-Vym58og7aZw05IkoDvse8..c2lnbg") // nolint: errcheck
577 if _, err := c.saveUploadFile(ctx, tk, []byte("123"), "test.txt", "abc", []string{"Action1|https://127.0.0.1:8080"}); err != nil {
578 t.Error("Save text failed", err)
579 }
580}
581
582func TestSaveFileFailed(t *testing.T) {
583 c := New()

Callers

nothing calls this directly

Calls 5

ParseTokenFunction · 0.92
NewFunction · 0.85
InitMethod · 0.80
saveUploadFileMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected