Skip to content

Commit def3d76

Browse files
mascheckMarcel Scheck
andauthored
Add subnet type cloud (#81)
Co-authored-by: Marcel Scheck <[email protected]>
1 parent 62af074 commit def3d76

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ History
55
master (XXXX-XX-XX)
66
--------------------
77
* Feature: Add support for the optional 'networks' parameter on server creation.
8+
* Feature: Add subnet type `cloud`
89

910
1.6.3 (2020-01-09)
1011
--------------------

tests/integration/networks/test_networks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def bound_network(self, hetzner_client):
1313

1414
@pytest.fixture()
1515
def network_subnet(self):
16-
return NetworkSubnet(type="server", ip_range="10.0.1.0/24", network_zone="eu-central")
16+
return NetworkSubnet(type="cloud", ip_range="10.0.1.0/24", network_zone="eu-central")
1717

1818
@pytest.fixture()
1919
def network_route(self):
@@ -77,7 +77,7 @@ class TestNetworksClient(object):
7777

7878
@pytest.fixture()
7979
def network_subnet(self):
80-
return NetworkSubnet(type="server", ip_range="10.0.1.0/24", network_zone="eu-central")
80+
return NetworkSubnet(type="cloud", ip_range="10.0.1.0/24", network_zone="eu-central")
8181

8282
@pytest.fixture()
8383
def network_route(self):

tests/unit/networks/conftest.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def network_response():
1111
"ip_range": "10.0.0.0/16",
1212
"subnets": [
1313
{
14-
"type": "server",
14+
"type": "cloud",
1515
"ip_range": "10.0.1.0/24",
1616
"network_zone": "eu-central",
1717
"gateway": "10.0.0.1"
@@ -51,7 +51,7 @@ def two_networks_response():
5151
"ip_range": "10.0.0.0/16",
5252
"subnets": [
5353
{
54-
"type": "server",
54+
"type": "cloud",
5555
"ip_range": "10.0.1.0/24",
5656
"network_zone": "eu-central",
5757
"gateway": "10.0.0.1"
@@ -84,7 +84,7 @@ def two_networks_response():
8484
"ip_range": "12.0.0.0/8",
8585
"subnets": [
8686
{
87-
"type": "server",
87+
"type": "cloud",
8888
"ip_range": "12.0.1.0/24",
8989
"network_zone": "eu-central",
9090
"gateway": "12.0.0.1"
@@ -119,7 +119,7 @@ def one_network_response():
119119
"ip_range": "10.0.0.0/16",
120120
"subnets": [
121121
{
122-
"type": "server",
122+
"type": "cloud",
123123
"ip_range": "10.0.1.0/24",
124124
"network_zone": "eu-central",
125125
"gateway": "10.0.0.1"
@@ -158,7 +158,7 @@ def network_create_response():
158158
"ip_range": "10.0.0.0/16",
159159
"subnets": [
160160
{
161-
"type": "server",
161+
"type": "cloud",
162162
"ip_range": "10.0.1.0/24",
163163
"network_zone": "eu-central",
164164
"gateway": "10.0.0.1"
@@ -191,7 +191,7 @@ def response_update_network():
191191
"ip_range": "10.0.0.0/16",
192192
"subnets": [
193193
{
194-
"type": "server",
194+
"type": "cloud",
195195
"ip_range": "10.0.1.0/24",
196196
"network_zone": "eu-central",
197197
"gateway": "10.0.0.1"

tests/unit/networks/test_client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_bound_network_init(self, network_response):
3333

3434
assert len(bound_network.subnets) == 2
3535
assert isinstance(bound_network.subnets[0], NetworkSubnet)
36-
assert bound_network.subnets[0].type == "server"
36+
assert bound_network.subnets[0].type == "cloud"
3737
assert bound_network.subnets[0].ip_range == "10.0.1.0/24"
3838
assert bound_network.subnets[0].network_zone == "eu-central"
3939
assert bound_network.subnets[0].gateway == "10.0.0.1"
@@ -80,10 +80,10 @@ def test_change_protection(self, hetzner_client, bound_network, generic_action):
8080

8181
def test_add_subnet(self, hetzner_client, bound_network, generic_action):
8282
hetzner_client.request.return_value = generic_action
83-
subnet = NetworkSubnet(type="server", ip_range="10.0.1.0/24", network_zone="eu-central")
83+
subnet = NetworkSubnet(type="cloud", ip_range="10.0.1.0/24", network_zone="eu-central")
8484
action = bound_network.add_subnet(subnet)
8585
hetzner_client.request.assert_called_with(url="/networks/14/actions/add_subnet", method="POST",
86-
json={"type": "server", "ip_range": "10.0.1.0/24",
86+
json={"type": "cloud", "ip_range": "10.0.1.0/24",
8787
"network_zone": "eu-central"})
8888

8989
assert action.id == 1
@@ -137,7 +137,7 @@ def networks_client(self):
137137

138138
@pytest.fixture()
139139
def network_subnet(self):
140-
return NetworkSubnet(type="server", ip_range="10.0.1.0/24", network_zone="eu-central")
140+
return NetworkSubnet(type="cloud", ip_range="10.0.1.0/24", network_zone="eu-central")
141141

142142
@pytest.fixture()
143143
def network_route(self):
@@ -243,7 +243,7 @@ def test_create_with_subnet(self, networks_client, network_subnet, network_creat
243243
'ip_range': "10.0.0.0/8",
244244
'subnets': [
245245
{
246-
'type': "server",
246+
'type': "cloud",
247247
'ip_range': "10.0.1.0/24",
248248
'network_zone': "eu-central"
249249
}
@@ -290,7 +290,7 @@ def test_create_with_route_and_subnet(self, networks_client, network_subnet, net
290290
'ip_range': "10.0.0.0/8",
291291
'subnets': [
292292
{
293-
'type': "server",
293+
'type': "cloud",
294294
'ip_range': "10.0.1.0/24",
295295
'network_zone': "eu-central"
296296
}
@@ -352,7 +352,7 @@ def test_add_subnet(self, networks_client, network, generic_action, network_subn
352352

353353
action = networks_client.add_subnet(network, network_subnet)
354354
networks_client._client.request.assert_called_with(url="/networks/1/actions/add_subnet", method="POST",
355-
json={"type": "server", "ip_range": "10.0.1.0/24",
355+
json={"type": "cloud", "ip_range": "10.0.1.0/24",
356356
"network_zone": "eu-central"})
357357

358358
assert action.id == 1

0 commit comments

Comments
 (0)