2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-13 14:22:23 +00:00
restic/backend/s3/uri_test.go

34 lines
571 B
Go
Raw Normal View History

2015-12-28 14:51:24 +00:00
package s3
import "testing"
var uriTests = []struct {
s string
cfg Config
}{
{"s3://eu-central-1/bucketname", Config{
Host: "eu-central-1",
Bucket: "bucketname",
}},
{"s3:hostname:foobar", Config{
Host: "hostname",
Bucket: "foobar",
}},
}
func TestParseConfig(t *testing.T) {
for i, test := range uriTests {
cfg, err := ParseConfig(test.s)
if err != nil {
t.Errorf("test %d failed: %v", i, err)
continue
}
if cfg != test.cfg {
t.Errorf("test %d: wrong config, want:\n %v\ngot:\n %v",
i, test.cfg, cfg)
continue
}
}
}