forked from evcc-io/evcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoctopus_test.go
37 lines (29 loc) · 850 Bytes
/
octopus_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
package tariff
import (
"testing"
"github.com/evcc-io/evcc/util/test"
"github.com/stretchr/testify/require"
)
func TestOctopusConfigParse(t *testing.T) {
test.SkipCI(t)
// This test will start failing if you remove the deprecated "tariff" config var.
validTariffConfig := map[string]interface{}{
"region": "H",
"tariff": "GO-22-03-29",
}
_, err := NewOctopusFromConfig(validTariffConfig)
require.NoError(t, err)
validProductCodeConfig := map[string]interface{}{
"region": "H",
"productcode": "GO-22-03-29",
}
_, err = NewOctopusFromConfig(validProductCodeConfig)
require.NoError(t, err)
invalidApiAndProductCodeConfig := map[string]interface{}{
"region": "H",
"productcode": "GO-22-03-29",
"apikey": "nope",
}
_, err = NewOctopusFromConfig(invalidApiAndProductCodeConfig)
require.Error(t, err)
}