Skip to content

Commit a9915d4

Browse files
Merge pull request #332 from lgarber-akamai/new/dc-e2e
new: Add integration test for `region_prices` Type field
2 parents 02a4991 + 182dec6 commit a9915d4

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

test/integration/conftest.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,24 @@
66
from linode_api4.linode_client import LinodeClient
77

88
ENV_TOKEN_NAME = "LINODE_TOKEN"
9+
ENV_API_URL_NAME = "LINODE_API_URL"
10+
ENV_API_CA_NAME = "LINODE_API_CA"
911
RUN_LONG_TESTS = "RUN_LONG_TESTS"
1012

1113

1214
def get_token():
1315
return os.environ.get(ENV_TOKEN_NAME, None)
1416

1517

18+
def get_api_url():
19+
return os.environ.get(ENV_API_URL_NAME, "https://api.linode.com/v4beta")
20+
21+
22+
def get_api_ca_file():
23+
result = os.environ.get(ENV_API_CA_NAME, None)
24+
return result if result != "" else None
25+
26+
1627
def run_long_tests():
1728
return os.environ.get(RUN_LONG_TESTS, None)
1829

@@ -71,7 +82,13 @@ def ssh_key_gen():
7182
@pytest.fixture(scope="session")
7283
def get_client():
7384
token = get_token()
74-
client = LinodeClient(token)
85+
api_url = get_api_url()
86+
api_ca_file = get_api_ca_file()
87+
client = LinodeClient(
88+
token,
89+
base_url=api_url,
90+
ca_path=api_ca_file,
91+
)
7592
return client
7693

7794

test/integration/models/test_linode.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,22 @@ def test_get_linode_types(get_client):
398398
assert "g6-nanode-1" in ids
399399

400400

401+
def test_get_linode_types_overrides(get_client):
402+
types = get_client.linode.types()
403+
404+
target_types = [
405+
v
406+
for v in types
407+
if len(v.region_prices) > 0 and v.region_prices[0].hourly > 0
408+
]
409+
410+
assert len(target_types) > 0
411+
412+
for linode_type in target_types:
413+
assert linode_type.region_prices[0].hourly >= 0
414+
assert linode_type.region_prices[0].monthly >= 0
415+
416+
401417
def test_get_linode_type_by_id(get_client):
402418
pytest.skip(
403419
"Might need Type to match how other object models are behaving e.g. client.load(Type, 123)"

0 commit comments

Comments
 (0)