...
1 package storage
2
3 import (
4 "context"
5 "testing"
6
7 gcs "cloud.google.com/go/storage"
8 "github.com/stretchr/testify/assert"
9 "google.golang.org/api/option"
10 )
11
12 func TestOptions(t *testing.T) {
13 o := bucketOpts{}
14 bucket := "test-bucket"
15
16 fn := WithBucket(bucket)
17 fn(&o)
18 assert.Equal(t, bucket, o.bucketName, "options bucket name doesnt match input name")
19
20 so := storageOpts{}
21 client, err := gcs.NewClient(context.Background(), option.WithoutAuthentication())
22 assert.NoError(t, err)
23 sfn := WithClient(client)
24 sfn(&so)
25 assert.Equal(t, client, so.client, "options client doesnt match input client")
26 }
27
28
29
30 func TestActionsPath(t *testing.T) {
31 assert.Equal(t, "actions/edge-infra/presubmit/3018302/ci", BasePath("edge-infra", "presubmit", "3018302", "ci"))
32 }
33
View as plain text