-
Notifications
You must be signed in to change notification settings - Fork 3
/
computeResourcesSettings_test.go
36 lines (30 loc) · 1.09 KB
/
computeResourcesSettings_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
package solus
import (
"context"
"net/http"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestComputeResourcesService_SettingsUpdate(t *testing.T) {
data := ComputeResourceSettings{
CachePath: "fake cache path",
ISOPath: "fake ISO path",
BackupTmpPath: "fake backup tmp path",
VNCProxyPort: 1337,
Limits: ComputeResourceSettingsLimits{},
Network: ComputeResourceSettingsNetwork{},
BalanceStrategy: ComputeResourceBalanceStrategyMostStorageAvailable,
VirtualizationTypes: []VirtualizationType{VirtualizationTypeKVM, VirtualizationTypeVZ},
}
s := startTestServer(t, func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, "/compute_resources/10/settings", r.URL.Path)
assert.Equal(t, http.MethodPut, r.Method)
assertRequestBody(t, r, data)
writeResponse(t, w, http.StatusOK, data)
})
defer s.Close()
actual, err := createTestClient(t, s.URL).ComputeResources.SettingsUpdate(context.Background(), 10, data)
require.NoError(t, err)
require.Equal(t, data, actual)
}