-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_test.go
48 lines (43 loc) · 1.31 KB
/
client_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2020 - MinIO, Inc. All rights reserved.
// Use of this source code is governed by the AGPLv3
// license that can be found in the LICENSE file.
package kes
import (
"testing"
)
var endpointTests = []struct {
Endpoint string
Elements []string
URL string
}{
{Endpoint: "https://127.0.0.1:7373", Elements: nil, URL: "https://127.0.0.1:7373"},
{Endpoint: "https://127.0.0.1:7373/", Elements: nil, URL: "https://127.0.0.1:7373"},
{Endpoint: " https://127.0.0.1:7373/ ", Elements: nil, URL: "https://127.0.0.1:7373"},
{
Endpoint: "https://play.min.io:7373",
Elements: []string{"/version"},
URL: "https://play.min.io:7373/version",
},
{
Endpoint: "https://play.min.io:7373",
Elements: []string{"version"},
URL: "https://play.min.io:7373/version",
},
{
Endpoint: "https://127.0.0.1:7373",
Elements: []string{"/key/create/my-key"},
URL: "https://127.0.0.1:7373/key/create/my-key",
},
{
Endpoint: "https://127.0.0.1:7373",
Elements: []string{"/key", "/create", "my-key"},
URL: "https://127.0.0.1:7373/key/create/my-key",
},
}
func TestEndpoint(t *testing.T) {
for i, test := range endpointTests {
if url := endpoint(test.Endpoint, test.Elements...); url != test.URL {
t.Fatalf("Test %d: endpoint url mismatch: got '%s' - want '%s'", i, url, test.URL)
}
}
}