| 306 | } |
| 307 | |
| 308 | func TestFileSystemUpload(t *testing.T) { |
| 309 | dir := createTestDir(t) |
| 310 | defer os.RemoveAll(dir) |
| 311 | |
| 312 | fsys, err := filesystem.NewLocal(dir) |
| 313 | if err != nil { |
| 314 | t.Fatal(err) |
| 315 | } |
| 316 | defer fsys.Close() |
| 317 | |
| 318 | fileKey := "newdir/newkey.txt" |
| 319 | |
| 320 | uploadErr := fsys.Upload([]byte("demo"), fileKey) |
| 321 | if uploadErr != nil { |
| 322 | t.Fatal(uploadErr) |
| 323 | } |
| 324 | |
| 325 | if exists, _ := fsys.Exists(fileKey); !exists { |
| 326 | t.Fatalf("Expected %s to exist", fileKey) |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | func TestFileSystemServe(t *testing.T) { |
| 331 | dir := createTestDir(t) |