forked from linode/linode_api4-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregion_test.py
More file actions
53 lines (40 loc) · 1.6 KB
/
Copy pathregion_test.py
File metadata and controls
53 lines (40 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from test.unit.base import ClientBaseCase
from linode_api4.objects import Region
class RegionTest(ClientBaseCase):
"""
Tests methods of the Region class
"""
def test_get_region(self):
"""
Tests that a Region is loaded correctly by ID
"""
region = Region(self.client, "us-east")
self.assertEqual(region.id, "us-east")
self.assertEqual(region.country, "us")
self.assertEqual(region.label, "label7")
self.assertEqual(region.status, "ok")
self.assertIsNotNone(region.resolvers)
self.assertEqual(region.site_type, "core")
self.assertEqual(
region.placement_group_limits.maximum_pgs_per_customer, 5
)
self.assertEqual(
region.placement_group_limits.maximum_linodes_per_pg, 5
)
# Test monitors section
self.assertIsNotNone(region.monitors)
self.assertEqual(region.monitors.alerts, ["Managed Databases"])
self.assertEqual(region.monitors.metrics, ["Managed Databases"])
self.assertIsNotNone(region.capabilities)
self.assertIn("Linode Interfaces", region.capabilities)
def test_region_availability(self):
"""
Tests that availability for a specific region can be listed and filtered on.
"""
avail_entries = Region(self.client, "us-east").availability
for entry in avail_entries:
assert entry.region is not None
assert len(entry.region) > 0
assert entry.plan is not None
assert len(entry.plan) > 0
assert entry.available is not None