(t *testing.T)
| 564 | } |
| 565 | |
| 566 | func 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 | |
| 582 | func TestSaveFileFailed(t *testing.T) { |
| 583 | c := New() |
nothing calls this directly
no test coverage detected