diff --git a/test/integration/models/lke/test_lke.py b/test/integration/models/lke/test_lke.py index 8fc89bc63..eb31c8eb6 100644 --- a/test/integration/models/lke/test_lke.py +++ b/test/integration/models/lke/test_lke.py @@ -15,8 +15,14 @@ LKEClusterControlPlaneACLOptions, LKEClusterControlPlaneOptions, ) +from linode_api4.common import RegionPrice from linode_api4.errors import ApiError -from linode_api4.objects import LKECluster, LKENodePool, LKENodePoolTaint +from linode_api4.objects import ( + LKECluster, + LKENodePool, + LKENodePoolTaint, + LKEType, +) @pytest.fixture(scope="session") @@ -325,4 +331,17 @@ def test_lke_cluster_labels_and_taints(lke_cluster_with_labels_and_taints): def test_lke_types(test_linode_client): types = test_linode_client.lke.types() - assert len(types) > 0 + if len(types) > 0: + for lke_type in types: + assert type(lke_type) is LKEType + assert lke_type.price.monthly is None or ( + isinstance(lke_type.price.monthly, (float, int)) + and lke_type.price.monthly >= 0 + ) + if len(lke_type.region_prices) > 0: + region_price = lke_type.region_prices[0] + assert type(region_price) is RegionPrice + assert lke_type.price.monthly is None or ( + isinstance(lke_type.price.monthly, (float, int)) + and lke_type.price.monthly >= 0 + ) diff --git a/test/integration/models/networking/test_networking.py b/test/integration/models/networking/test_networking.py index 80c9f1418..3eb455cb4 100644 --- a/test/integration/models/networking/test_networking.py +++ b/test/integration/models/networking/test_networking.py @@ -3,6 +3,7 @@ import pytest from linode_api4.objects import Config, ConfigInterfaceIPv4, Firewall, IPAddress +from linode_api4.objects.networking import NetworkTransferPrice, Price @pytest.mark.smoke @@ -126,4 +127,10 @@ def test_ip_info_vpc(test_linode_client, create_vpc_with_subnet_and_linode): def test_network_transfer_prices(test_linode_client): transfer_prices = test_linode_client.networking.transfer_prices() - assert len(transfer_prices) > 0 + if len(transfer_prices) > 0: + assert type(transfer_prices[0]) is NetworkTransferPrice + assert type(transfer_prices[0].price) is Price + assert ( + transfer_prices[0].price is None + or transfer_prices[0].price.hourly >= 0 + ) diff --git a/test/integration/models/nodebalancer/test_nodebalancer.py b/test/integration/models/nodebalancer/test_nodebalancer.py index 3ac134941..a3c00cee9 100644 --- a/test/integration/models/nodebalancer/test_nodebalancer.py +++ b/test/integration/models/nodebalancer/test_nodebalancer.py @@ -3,7 +3,12 @@ import pytest from linode_api4 import ApiError -from linode_api4.objects import NodeBalancerConfig, NodeBalancerNode +from linode_api4.objects import ( + NodeBalancerConfig, + NodeBalancerNode, + NodeBalancerType, + RegionPrice, +) @pytest.fixture(scope="session") @@ -126,4 +131,17 @@ def test_delete_nb_node(test_linode_client, create_nb_config): def test_nodebalancer_types(test_linode_client): types = test_linode_client.nodebalancers.types() - assert len(types) > 0 + if len(types) > 0: + for nb_type in types: + assert type(nb_type) is NodeBalancerType + assert nb_type.price.monthly is None or ( + isinstance(nb_type.price.monthly, (float, int)) + and nb_type.price.monthly >= 0 + ) + if len(nb_type.region_prices) > 0: + region_price = nb_type.region_prices[0] + assert type(region_price) is RegionPrice + assert region_price.monthly is None or ( + isinstance(region_price.monthly, (float, int)) + and region_price.monthly >= 0 + ) diff --git a/test/integration/models/volume/test_volume.py b/test/integration/models/volume/test_volume.py index 1eb4087d2..820f7027a 100644 --- a/test/integration/models/volume/test_volume.py +++ b/test/integration/models/volume/test_volume.py @@ -9,7 +9,7 @@ import pytest from linode_api4 import ApiError, LinodeClient -from linode_api4.objects import Volume +from linode_api4.objects import RegionPrice, Volume, VolumeType @pytest.fixture(scope="session") @@ -126,4 +126,17 @@ def test_detach_volume_to_linode( def test_volume_types(test_linode_client): types = test_linode_client.volumes.types() - assert len(types) > 0 + if len(types) > 0: + for volume_type in types: + assert type(volume_type) is VolumeType + assert volume_type.price.monthly is None or ( + isinstance(volume_type.price.monthly, (float, int)) + and volume_type.price.monthly >= 0 + ) + if len(volume_type.region_prices) > 0: + region_price = volume_type.region_prices[0] + assert type(region_price) is RegionPrice + assert region_price.monthly is None or ( + isinstance(region_price.monthly, (float, int)) + and region_price.monthly >= 0 + )