|
3 | 3 |
|
4 | 4 | import pytest |
5 | 5 |
|
| 6 | +from linode_api4.common import RegionPrice |
6 | 7 | from linode_api4.linode_client import LinodeClient |
7 | 8 | from linode_api4.objects.object_storage import ( |
8 | 9 | ObjectStorageACL, |
|
11 | 12 | ObjectStorageEndpointType, |
12 | 13 | ObjectStorageKeyPermission, |
13 | 14 | ObjectStorageKeys, |
| 15 | + ObjectStorageType, |
14 | 16 | ) |
15 | 17 |
|
16 | 18 |
|
@@ -191,3 +193,22 @@ def test_get_buckets_in_cluster( |
191 | 193 | ): |
192 | 194 | cluster = test_linode_client.load(ObjectStorageCluster, bucket.cluster) |
193 | 195 | assert any(bucket.id == b.id for b in cluster.buckets_in_cluster()) |
| 196 | + |
| 197 | + |
| 198 | +def test_object_storage_types(test_linode_client): |
| 199 | + types = test_linode_client.object_storage.types() |
| 200 | + |
| 201 | + if len(types) > 0: |
| 202 | + for object_storage_type in types: |
| 203 | + assert type(object_storage_type) is ObjectStorageType |
| 204 | + assert object_storage_type.price.monthly is None or ( |
| 205 | + isinstance(object_storage_type.price.monthly, (float, int)) |
| 206 | + and object_storage_type.price.monthly >= 0 |
| 207 | + ) |
| 208 | + if len(object_storage_type.region_prices) > 0: |
| 209 | + region_price = object_storage_type.region_prices[0] |
| 210 | + assert type(region_price) is RegionPrice |
| 211 | + assert object_storage_type.price.monthly is None or ( |
| 212 | + isinstance(object_storage_type.price.monthly, (float, int)) |
| 213 | + and object_storage_type.price.monthly >= 0 |
| 214 | + ) |
0 commit comments