File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 66from linode_api4 .linode_client import LinodeClient
77
88ENV_TOKEN_NAME = "LINODE_TOKEN"
9+ ENV_API_URL_NAME = "LINODE_API_URL"
10+ ENV_API_CA_NAME = "LINODE_API_CA"
911RUN_LONG_TESTS = "RUN_LONG_TESTS"
1012
1113
1214def 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+
1627def 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" )
7283def 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
Original file line number Diff line number Diff 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+
401417def 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)"
You can’t perform that action at this time.
0 commit comments