Skip to content

Commit

Permalink
test(objsto): validate name property
Browse files Browse the repository at this point in the history
  • Loading branch information
kangasta committed Dec 19, 2023
1 parent 30b282b commit 921cfd3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions upcloud/managed_object_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func TestManagedObjectStorage(t *testing.T) {
Key: "managedBy",
Value: "upcloud-go-sdk-unit-test",
}},
Name: "go-sdk-test-objsto",
Networks: []ManagedObjectStorageNetwork{
{
Family: "IPv4",
Expand Down Expand Up @@ -82,6 +83,7 @@ func TestManagedObjectStorage(t *testing.T) {
"value": "upcloud-go-sdk-unit-test"
}
],
"name": "go-sdk-test-objsto",
"networks": [
{
"family": "IPv4",
Expand Down
18 changes: 18 additions & 0 deletions upcloud/request/managed_object_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ func TestCreateManagedObjectStorageRequest_MarshalJSON(t *testing.T) {
}`
assert.JSONEq(t, expected, string(d))
})

t.Run("TestWithName", func(t *testing.T) {
req := CreateManagedObjectStorageRequest{
Name: "test-objsto-name",
Region: "europe-1",
}
d, err := json.Marshal(&req)
assert.NoError(t, err)

const expected = `{
"configured_status":"",
"name":"test-objsto-name",
"networks":null,
"region":"europe-1",
"users":null
}`
assert.JSONEq(t, expected, string(d))
})
}

func TestGetManagedObjectStoragesRequest_RequestURL(t *testing.T) {
Expand Down

0 comments on commit 921cfd3

Please sign in to comment.