Skip to content

Commit b71252e

Browse files
progress
1 parent 8b6bf20 commit b71252e

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

test/unit/fixtures/vpc_get.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
"label": "test-vpc",
44
"description": "Test VPC description",
55
"region": "us-east",
6+
"ipv6": [
7+
{
8+
"range": "fd71:1140:a9d0::/52"
9+
}
10+
],
611
"subnets": [],
712
"created": "2023-01-01T12:00:00",
813
"updated": "2023-01-02T12:00:00"

test/unit/vpc_test.go

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"testing"
66
"time"
77

8+
"github.com/stretchr/testify/require"
9+
810
"github.com/linode/linodego"
911
"github.com/stretchr/testify/assert"
1012
)
@@ -19,6 +21,11 @@ func TestVPC_Create(t *testing.T) {
1921
Label: "test-vpc",
2022
Description: "Test VPC description",
2123
Region: "us-east",
24+
IPv6: []linodego.VPCIPv6Range{
25+
{
26+
Range: "fd71:1140:a9d0::/52",
27+
},
28+
},
2229
Subnets: []linodego.VPCSubnet{
2330
{ID: 1, Label: "subnet-1"},
2431
{ID: 2, Label: "subnet-2"},
@@ -31,6 +38,12 @@ func TestVPC_Create(t *testing.T) {
3138
Label: "test-vpc",
3239
Description: "Test VPC description",
3340
Region: "us-east",
41+
IPv6: []linodego.VPCCreateOptionsIPv6{
42+
{
43+
Range: linodego.Pointer("/52"),
44+
AllocationClass: linodego.Pointer("test"),
45+
},
46+
},
3447
Subnets: []linodego.VPCSubnetCreateOptions{
3548
{Label: "subnet-1"},
3649
{Label: "subnet-2"},
@@ -48,17 +61,21 @@ func TestVPC_Get(t *testing.T) {
4861
base.SetUp(t)
4962
defer base.TearDown(t)
5063

51-
mockVPC := linodego.VPC{
52-
ID: 123,
53-
Label: "test-vpc",
54-
}
55-
base.MockGet("vpcs/123", mockVPC)
64+
fixtureData, err := fixtures.GetFixture("vpc_get")
65+
require.NoError(t, err)
66+
67+
base.MockGet("vpcs/123", fixtureData)
5668

5769
vpc, err := base.Client.GetVPC(context.Background(), 123)
70+
5871
assert.NoError(t, err, "Expected no error when getting VPC")
5972
assert.NotNil(t, vpc, "Expected non-nil VPC")
60-
assert.Equal(t, mockVPC.ID, vpc.ID, "Expected VPC ID to match")
61-
assert.Equal(t, mockVPC.Label, vpc.Label, "Expected VPC label to match")
73+
assert.Equal(t, 123, vpc.ID, "Expected VPC ID to match")
74+
assert.Equal(t, "test-vpc", vpc.Label, "Expected VPC label to match")
75+
assert.Equal(t, "Test VPC description", vpc.Description)
76+
assert.Equal(t, "us-east", vpc.Region)
77+
assert.Equal(t, "fd71:1140:a9d0::/52", vpc.IPv6[0].Range)
78+
assert.Len(t, vpc.Subnets, 0)
6279
}
6380

6481
func TestVPC_List(t *testing.T) {

0 commit comments

Comments
 (0)