Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ release: build
twine upload dist/*

@PHONEY: install
install: clean
install: clean requirements
python3 -m pip install .

@PHONEY: requirements
Expand Down
1 change: 1 addition & 0 deletions linode_api4/objects/linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ class Type(Base):
"label": Property(),
"network_out": Property(),
"price": Property(),
"region_prices": Property(),
"addons": Property(),
"memory": Property(),
"transfer": Property(),
Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/account_transfer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"quota": 471,
"used": 737373,
"billable": 0,

"region_transfers": [
{
"id": "ap-west",
"used": 1,
"quota": 5010,
"billable": 0
}
]
}
114 changes: 105 additions & 9 deletions test/fixtures/linode_types.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"results": 4,
"pages": 1,
"page": 1,
"data": [
"results": 4,
"pages": 1,
"page": 1,
"data": [
{
"disk": 20480,
"memory": 1024,
Expand All @@ -12,7 +12,19 @@
"price": {
"hourly": 0.003,
"monthly": 2
}
},
"region_prices": [
{
"id": "ap-west",
"hourly": 0.02,
"monthly": 20
},
{
"id": "ap-northeast",
"hourly": 0.02,
"monthly": 20
}
]
}
},
"class": "nanode",
Expand All @@ -25,6 +37,18 @@
"hourly": 0.0075,
"monthly": 5
},
"region_prices": [
{
"id": "us-east",
"hourly": 0.02,
"monthly": 20
},
{
"id": "ap-northeast",
"hourly": 0.02,
"monthly": 20
}
],
"successor": null
},
{
Expand All @@ -36,7 +60,19 @@
"price": {
"hourly": 0.008,
"monthly": 5
}
},
"region_prices": [
{
"id": "ap-west",
"hourly": 0.02,
"monthly": 20
},
{
"id": "ap-northeast",
"hourly": 0.02,
"monthly": 20
}
]
}
},
"class": "highmem",
Expand All @@ -49,6 +85,18 @@
"hourly": 0.09,
"monthly": 60
},
"region_prices": [
{
"id": "us-east",
"hourly": 0.02,
"monthly": 20
},
{
"id": "ap-northeast",
"hourly": 0.02,
"monthly": 20
}
],
"successor": null
},
{
Expand All @@ -60,7 +108,19 @@
"price": {
"hourly": 0.004,
"monthly": 2.5
}
},
"region_prices": [
{
"id": "ap-west",
"hourly": 0.02,
"monthly": 20
},
{
"id": "ap-northeast",
"hourly": 0.02,
"monthly": 20
}
]
}
},
"class": "standard",
Expand All @@ -73,6 +133,18 @@
"hourly": 0.015,
"monthly": 10
},
"region_prices": [
{
"id": "us-east",
"hourly": 0.02,
"monthly": 20
},
{
"id": "ap-northeast",
"hourly": 0.02,
"monthly": 20
}
],
"successor": null
},
{
Expand All @@ -84,7 +156,19 @@
"price": {
"hourly": 0.008,
"monthly": 5
}
},
"region_prices": [
{
"id": "ap-west",
"hourly": 0.02,
"monthly": 20
},
{
"id": "ap-northeast",
"hourly": 0.02,
"monthly": 20
}
]
}
},
"class": "gpu",
Expand All @@ -97,7 +181,19 @@
"hourly": 0.03,
"monthly": 20
},
"region_prices": [
{
"id": "us-east",
"hourly": 0.02,
"monthly": 20
},
{
"id": "ap-northeast",
"hourly": 0.02,
"monthly": 20
}
],
"successor": null
}
]
}
}
2 changes: 1 addition & 1 deletion test/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest

from linode_api4.linode_client import LinodeClient, LongviewSubscription
from linode_api4.linode_client import LinodeClient

ENV_TOKEN_NAME = "LINODE_TOKEN"
RUN_LONG_TESTS = "RUN_LONG_TESTS"
Expand Down
16 changes: 16 additions & 0 deletions test/unit/linode_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,22 @@ def test_join_beta_program(self):
)
self.assertEqual(m.call_url, join_beta_url)

def test_account_transfer(self):
"""
Tests that payments can be retrieved
"""
transfer = self.client.account.transfer()

self.assertEqual(transfer.quota, 471)
self.assertEqual(transfer.used, 737373)
self.assertEqual(transfer.billable, 0)

self.assertEqual(len(transfer.region_transfers), 1)
self.assertEqual(transfer.region_transfers[0].id, "ap-west")
self.assertEqual(transfer.region_transfers[0].used, 1)
self.assertEqual(transfer.region_transfers[0].quota, 5010)
self.assertEqual(transfer.region_transfers[0].billable, 0)


class BetaProgramGroupTest(ClientBaseCase):
"""
Expand Down
3 changes: 3 additions & 0 deletions test/unit/objects/linode_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,8 @@ def test_get_types(self):
self.assertIsNotNone(t.type_class)
self.assertIsNotNone(t.gpus)
self.assertIsNone(t.successor)
self.assertIsNotNone(t.region_prices)
self.assertIsNotNone(t.addons.backups.region_prices)

def test_get_type_by_id(self):
"""
Expand All @@ -546,6 +548,7 @@ def test_get_type_by_id(self):
self.assertEqual(t.label, "Linode 1024")
self.assertEqual(t.disk, 20480)
self.assertEqual(t.type_class, "nanode")
self.assertEqual(t.region_prices[0].id, "us-east")

def test_get_type_gpu(self):
"""
Expand Down