-
Notifications
You must be signed in to change notification settings - Fork 2
/
config_test.go
31 lines (24 loc) · 863 Bytes
/
config_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
package fabclient
import (
"testing"
)
func TestNewConfigFromFile(t *testing.T) {
if _, err := NewConfigFromFile("./testdata/fixtures/client-config.json"); err != nil {
t.Errorf("should have succeed, error: %w", err)
}
if _, err := NewConfigFromFile("./testdata/organizations/org1/client-config.yaml"); err != nil {
t.Errorf("should have succeed, error: %w", err)
}
if _, err := NewConfigFromFile(""); err == nil {
t.Error("should have returned an error, invalid path")
}
if _, err := NewConfigFromFile("./go.mod"); err == nil {
t.Error("should have returned an error, path towards a not supported extension file")
}
if _, err := NewConfigFromFile("./testdata/fixtures/invalid-client-config.json"); err == nil {
t.Fail()
}
if _, err := NewConfigFromFile("./testdata/fixtures/invalid-client-config.yaml"); err == nil {
t.Fail()
}
}