Skip to content

Commit c52b181

Browse files
public update test
1 parent 214eb17 commit c52b181

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

test/unit/objects/linode_interface_test.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
from linode_api4 import (
55
LinodeInterface,
6+
LinodeInterfacePublicIPv4AddressUpdateOptions,
7+
LinodeInterfacePublicIPv6RangeUpdateOptions,
68
)
79

810

@@ -120,4 +122,54 @@ def test_get_vlan(self):
120122
iface.invalidate()
121123
self.assert_linode_124_interface_789(iface)
122124

125+
def test_update_public(self):
126+
iface = LinodeInterface(self.client, 123, 124)
127+
128+
self.assert_linode_124_interface_123(iface)
129+
130+
iface.default_route.ipv4 = False
131+
iface.default_route.ipv6 = False
132+
133+
iface.public.ipv4.addresses = [
134+
LinodeInterfacePublicIPv4AddressUpdateOptions(
135+
address="172.30.0.51",
136+
primary=False,
137+
)
138+
]
139+
140+
iface.public.ipv6.ranges = [
141+
LinodeInterfacePublicIPv6RangeUpdateOptions(
142+
range="2600:3cO9:e001:58::/64"
143+
)
144+
]
145+
146+
with self.mock_put("/linode/instances/124/interfaces/123") as m:
147+
iface.save()
148+
149+
assert m.called
150+
151+
assert m.call_data == {
152+
"default_route": {
153+
"ipv4": False,
154+
"ipv6": False,
155+
},
156+
"public": {
157+
"ipv4": {
158+
"addresses": [
159+
{
160+
"address": "172.30.0.51",
161+
"primary": False,
162+
},
163+
]
164+
},
165+
"ipv6": {
166+
"ranges": [
167+
{
168+
"range": "2600:3cO9:e001:58::/64",
169+
}
170+
]
171+
},
172+
},
173+
}
174+
123175
# TODO (Enhanced Interfaces): iface update tests

0 commit comments

Comments
 (0)