(t *testing.T)
| 641 | } |
| 642 | |
| 643 | func TestTooLargeSaveTextFailed(t *testing.T) { |
| 644 | fpath := filepath.Join(os.TempDir(), "files") |
| 645 | defer os.RemoveAll(fpath) |
| 646 | os.MkdirAll(fpath, os.ModePerm) // nolint: errcheck |
| 647 | if f, err := os.Create(filepath.Join(fpath, "files")); err != nil { |
| 648 | f.Close() |
| 649 | } |
| 650 | logic.APIEndpoint = "http://127.0.0.1" |
| 651 | c := New() |
| 652 | defer c.Close() |
| 653 | c.Init(&logic.Options{DBUrl: "sqlite://?mode=memory", FilePath: fpath}) // nolint: errcheck |
| 654 | |
| 655 | tk, _ := model.ParseToken("EgMxMjMiBGNoYW4qBU1GUkdHMhQZZ_-_F4Oa-oQO0sLHXKqNSU8Qmw..c2lnbg") // nolint: errcheck |
| 656 | w := httptest.NewRecorder() |
| 657 | ctx, _ := gin.CreateTestContext(w) |
| 658 | ctx.Request, _ = http.NewRequest("GET", "/", nil) |
| 659 | if _, err := c.makeTextContent(model.NewMessage(tk), strings.Repeat("1", 500), strings.Repeat("2", 2000), "", "1", nil); err == nil { |
| 660 | t.Error("Check save too large text failed") |
| 661 | } |
| 662 | } |
| 663 | |
| 664 | func TestSendAction(t *testing.T) { |
| 665 | logic.APIEndpoint = "http://127.0.0.1" |
nothing calls this directly
no test coverage detected