Debian Codegraph @

snapshot_delete_repository_test.go

raw
1 // Copyright 2012-present Oliver Eilhard. All rights reserved.
2 // Use of this source code is governed by a MIT-license.
3 // See http://olivere.mit-license.org/license.txt for details.
4
5 package elastic
6
7 import "testing"
8
9 func TestSnapshotDeleteRepositoryURL(t *testing.T) {
10 client := setupTestClient(t)
11
12 tests := []struct {
13 Repository []string
14 Expected string
15 }{
16 {
17 []string{"repo1"},
18 "/_snapshot/repo1",
19 },
20 {
21 []string{"repo1", "repo2"},
22 "/_snapshot/repo1%2Crepo2",
23 },
24 }
25
26 for _, test := range tests {
27 path, _, err := client.SnapshotDeleteRepository(test.Repository...).buildURL()
28 if err != nil {
29 t.Fatal(err)
30 }
31 if path != test.Expected {
32 t.Errorf("expected %q; got: %q", test.Expected, path)
33 }
34 }
35 }