Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions linode_api4/objects/region.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Region(Base):
"status": Property(),
"resolvers": Property(),
"label": Property(),
"site_type": Property(),
}

@property
Expand Down
33 changes: 22 additions & 11 deletions test/fixtures/regions.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"ipv4": "172.105.34.5,172.105.35.5,172.105.36.5,172.105.37.5,172.105.38.5,172.105.39.5,172.105.40.5,172.105.41.5,172.105.42.5,172.105.43.5",
"ipv6": "2400:8904::f03c:91ff:fea5:659,2400:8904::f03c:91ff:fea5:9282,2400:8904::f03c:91ff:fea5:b9b3,2400:8904::f03c:91ff:fea5:925a,2400:8904::f03c:91ff:fea5:22cb,2400:8904::f03c:91ff:fea5:227a,2400:8904::f03c:91ff:fea5:924c,2400:8904::f03c:91ff:fea5:f7e2,2400:8904::f03c:91ff:fea5:2205,2400:8904::f03c:91ff:fea5:9207"
},
"label": "label1"
"label": "label1",
"site_type": "core"
},
{
"id": "ca-central",
Expand All @@ -28,7 +29,8 @@
"ipv4": "172.105.0.5,172.105.3.5,172.105.4.5,172.105.5.5,172.105.6.5,172.105.7.5,172.105.8.5,172.105.9.5,172.105.10.5,172.105.11.5",
"ipv6": "2600:3c04::f03c:91ff:fea9:f63,2600:3c04::f03c:91ff:fea9:f6d,2600:3c04::f03c:91ff:fea9:f80,2600:3c04::f03c:91ff:fea9:f0f,2600:3c04::f03c:91ff:fea9:f99,2600:3c04::f03c:91ff:fea9:fbd,2600:3c04::f03c:91ff:fea9:fdd,2600:3c04::f03c:91ff:fea9:fe2,2600:3c04::f03c:91ff:fea9:f68,2600:3c04::f03c:91ff:fea9:f4a"
},
"label": "label2"
"label": "label2",
"site_type": "core"
},
{
"id": "ap-southeast",
Expand All @@ -43,7 +45,8 @@
"ipv4": "172.105.166.5,172.105.169.5,172.105.168.5,172.105.172.5,172.105.162.5,172.105.170.5,172.105.167.5,172.105.171.5,172.105.181.5,172.105.161.5",
"ipv6": "2400:8907::f03c:92ff:fe6e:ec8,2400:8907::f03c:92ff:fe6e:98e4,2400:8907::f03c:92ff:fe6e:1c58,2400:8907::f03c:92ff:fe6e:c299,2400:8907::f03c:92ff:fe6e:c210,2400:8907::f03c:92ff:fe6e:c219,2400:8907::f03c:92ff:fe6e:1c5c,2400:8907::f03c:92ff:fe6e:c24e,2400:8907::f03c:92ff:fe6e:e6b,2400:8907::f03c:92ff:fe6e:e3d"
},
"label": "label3"
"label": "label3",
"site_type": "core"
},
{
"id": "us-central",
Expand All @@ -58,7 +61,8 @@
"ipv4": "72.14.179.5,72.14.188.5,173.255.199.5,66.228.53.5,96.126.122.5,96.126.124.5,96.126.127.5,198.58.107.5,198.58.111.5,23.239.24.5",
"ipv6": "2600:3c00::2,2600:3c00::9,2600:3c00::7,2600:3c00::5,2600:3c00::3,2600:3c00::8,2600:3c00::6,2600:3c00::4,2600:3c00::c,2600:3c00::b"
},
"label": "label4"
"label": "label4",
"site_type": "core"
},
{
"id": "us-west",
Expand All @@ -73,7 +77,8 @@
"ipv4": "173.230.145.5,173.230.147.5,173.230.155.5,173.255.212.5,173.255.219.5,173.255.241.5,173.255.243.5,173.255.244.5,74.207.241.5,74.207.242.5",
"ipv6": "2600:3c01::2,2600:3c01::9,2600:3c01::5,2600:3c01::7,2600:3c01::3,2600:3c01::8,2600:3c01::4,2600:3c01::b,2600:3c01::c,2600:3c01::6"
},
"label": "label5"
"label": "label5",
"site_type": "core"
},
{
"id": "us-southeast",
Expand All @@ -88,7 +93,8 @@
"ipv4": "74.207.231.5,173.230.128.5,173.230.129.5,173.230.136.5,173.230.140.5,66.228.59.5,66.228.62.5,50.116.35.5,50.116.41.5,23.239.18.5",
"ipv6": "2600:3c02::3,2600:3c02::5,2600:3c02::4,2600:3c02::6,2600:3c02::c,2600:3c02::7,2600:3c02::2,2600:3c02::9,2600:3c02::8,2600:3c02::b"
},
"label": "label6"
"label": "label6",
"site_type": "core"
},
{
"id": "us-east",
Expand All @@ -104,7 +110,8 @@
"ipv4": "66.228.42.5,96.126.106.5,50.116.53.5,50.116.58.5,50.116.61.5,50.116.62.5,66.175.211.5,97.107.133.4,207.192.69.4,207.192.69.5",
"ipv6": "2600:3c03::7,2600:3c03::4,2600:3c03::9,2600:3c03::6,2600:3c03::3,2600:3c03::c,2600:3c03::5,2600:3c03::b,2600:3c03::2,2600:3c03::8"
},
"label": "label7"
"label": "label7",
"site_type": "core"
},
{
"id": "eu-west",
Expand All @@ -119,7 +126,8 @@
"ipv4": "178.79.182.5,176.58.107.5,176.58.116.5,176.58.121.5,151.236.220.5,212.71.252.5,212.71.253.5,109.74.192.20,109.74.193.20,109.74.194.20",
"ipv6": "2a01:7e00::9,2a01:7e00::3,2a01:7e00::c,2a01:7e00::5,2a01:7e00::6,2a01:7e00::8,2a01:7e00::b,2a01:7e00::4,2a01:7e00::7,2a01:7e00::2"
},
"label": "label8"
"label": "label8",
"site_type": "core"
},
{
"id": "ap-south",
Expand All @@ -135,7 +143,8 @@
"ipv4": "139.162.11.5,139.162.13.5,139.162.14.5,139.162.15.5,139.162.16.5,139.162.21.5,139.162.27.5,103.3.60.18,103.3.60.19,103.3.60.20",
"ipv6": "2400:8901::5,2400:8901::4,2400:8901::b,2400:8901::3,2400:8901::9,2400:8901::2,2400:8901::8,2400:8901::7,2400:8901::c,2400:8901::6"
},
"label": "label9"
"label": "label9",
"site_type": "core"
},
{
"id": "eu-central",
Expand All @@ -151,7 +160,8 @@
"ipv4": "139.162.130.5,139.162.131.5,139.162.132.5,139.162.133.5,139.162.134.5,139.162.135.5,139.162.136.5,139.162.137.5,139.162.138.5,139.162.139.5",
"ipv6": "2a01:7e01::5,2a01:7e01::9,2a01:7e01::7,2a01:7e01::c,2a01:7e01::2,2a01:7e01::4,2a01:7e01::3,2a01:7e01::6,2a01:7e01::b,2a01:7e01::8"
},
"label": "label10"
"label": "label10",
"site_type": "core"
},
{
"id": "ap-northeast",
Expand All @@ -166,7 +176,8 @@
"ipv4": "139.162.66.5,139.162.67.5,139.162.68.5,139.162.69.5,139.162.70.5,139.162.71.5,139.162.72.5,139.162.73.5,139.162.74.5,139.162.75.5",
"ipv6": "2400:8902::3,2400:8902::6,2400:8902::c,2400:8902::4,2400:8902::2,2400:8902::8,2400:8902::7,2400:8902::5,2400:8902::b,2400:8902::9"
},
"label": "label11"
"label": "label11",
"site_type": "core"
}
],
"page": 1,
Expand Down
15 changes: 14 additions & 1 deletion test/integration/linode_client/test_linode_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest

from linode_api4 import ApiError, LinodeClient
from linode_api4.objects import ConfigInterface, ObjectStorageKeys
from linode_api4.objects import ConfigInterface, ObjectStorageKeys, Region


@pytest.fixture(scope="session", autouse=True)
Expand Down Expand Up @@ -66,6 +66,19 @@ def test_get_domains(test_linode_client, test_domain):
assert domain.domain in dom_list


@pytest.mark.smoke
def test_get_regions(test_linode_client):
client = test_linode_client
regions = client.regions()

region_list = [r.id for r in regions]

test_region = Region(client, "us-east")

assert test_region.id in region_list
assert test_region.site_type in ["core", "edge"]


@pytest.mark.smoke
def test_image_create(setup_client_and_linode):
client = setup_client_and_linode[0]
Expand Down
1 change: 1 addition & 0 deletions test/unit/linode_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def test_get_regions(self):
self.assertIsNotNone(region.resolvers)
self.assertIsNotNone(region.resolvers.ipv4)
self.assertIsNotNone(region.resolvers.ipv6)
self.assertEqual(region.site_type, "core")

def test_get_images(self):
r = self.client.images()
Expand Down
1 change: 1 addition & 0 deletions test/unit/objects/region_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_get_region(self):
self.assertEqual(region.label, "label7")
self.assertEqual(region.status, "ok")
self.assertIsNotNone(region.resolvers)
self.assertEqual(region.site_type, "core")

def test_list_availability(self):
"""
Expand Down