(t *testing.T)
| 25 | ) |
| 26 | |
| 27 | func TestBucket(t *testing.T) { |
| 28 | a := assertions.New(t) |
| 29 | ctx := test.Context() |
| 30 | |
| 31 | conf := config.BlobConfig{Provider: "local"} |
| 32 | conf.Local.Directory = t.TempDir() |
| 33 | |
| 34 | filename := "file" |
| 35 | content := []byte("Hello world") |
| 36 | |
| 37 | bucket, err := conf.Bucket(ctx, "bucket", test.HTTPClientProvider) |
| 38 | a.So(err, should.BeNil) |
| 39 | |
| 40 | err = bucket.WriteAll(ctx, filename, content, nil) |
| 41 | a.So(err, should.BeNil) |
| 42 | |
| 43 | fetcher := FromBucket(ctx, bucket, "") |
| 44 | |
| 45 | // Reading working file |
| 46 | { |
| 47 | fileContent, err := fetcher.File(filename) |
| 48 | a.So(err, should.BeNil) |
| 49 | a.So(string(fileContent), should.Equal, string(content)) |
| 50 | } |
| 51 | |
| 52 | // Reading non-working file |
| 53 | { |
| 54 | _, err = fetcher.File("non-existing file") |
| 55 | a.So(err, should.NotBeNil) |
| 56 | } |
| 57 | } |
nothing calls this directly
no test coverage detected