writeFiles puts real files in a temporary working directory, because uploading opens the path it is given. A name may include directories, which are created.
(t *testing.T, names ...string)
| 18 | // uploading opens the path it is given. A name may include directories, which |
| 19 | // are created. |
| 20 | func writeFiles(t *testing.T, names ...string) { |
| 21 | t.Helper() |
| 22 | |
| 23 | t.Chdir(t.TempDir()) |
| 24 | for _, name := range names { |
| 25 | require.NoError(t, os.MkdirAll(filepath.Dir(name), 0o755)) |
| 26 | require.NoError(t, os.WriteFile(name, []byte("the bytes"), 0o600)) |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | func testUploader(reg *httpmock.Registry) *Uploader { |
| 31 | return &Uploader{ |
no test coverage detected