MCPcopy Create free account
hub / github.com/imroc/req / TestSetFile

Function TestSetFile

request_test.go:969–978  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

967}
968
969func TestSetFile(t *testing.T) {
970 filename := "sample-file.txt"
971 resp := uploadTextFile(t, func(r *Request) {
972 r.SetFile("file", tests.GetTestFilePath(filename))
973 })
974 tests.AssertEqual(t, getTestFileContent(t, filename), resp.Bytes())
975
976 _, err := tc().SetLogger(nil).R().SetFile("file", "file-not-exists.txt").Post("/file-text")
977 tests.AssertErrorContains(t, err, "no such file")
978}
979
980func TestSetFiles(t *testing.T) {
981 filename := "sample-file.txt"

Callers

nothing calls this directly

Calls 11

GetTestFilePathFunction · 0.92
AssertEqualFunction · 0.92
AssertErrorContainsFunction · 0.92
uploadTextFileFunction · 0.85
getTestFileContentFunction · 0.85
tcFunction · 0.85
SetFileMethod · 0.80
BytesMethod · 0.80
RMethod · 0.80
SetLoggerMethod · 0.80
PostMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…