Skip to content

Commit 0e40b04

Browse files
Added missing fields to Volume object (#228)
Added missing fields (`filesystem_path`, `hardware_type`, and `linode_label`) to `Volume` object. Test by running `tox`. Ticket: TPT-1897
1 parent 4a826bf commit 0e40b04

4 files changed

Lines changed: 25 additions & 3 deletions

File tree

linode_api4/objects/volume.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ class Volume(Base):
1515
'status': Property(filterable=True),
1616
'region': Property(slug_relationship=Region),
1717
'tags': Property(mutable=True),
18+
'filesystem_path': Property(),
19+
'hardware_type': Property(),
20+
'linode_label': Property(),
1821
}
1922

2023
def attach(self, to_linode, config=None):

test/fixtures/volumes.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
"size": 40,
1010
"updated": "2017-08-04T04:00:00",
1111
"status": "active",
12-
"tags": ["something"]
12+
"tags": ["something"],
13+
"filesystem_path": "this/is/a/file/path",
14+
"hardware_type": "hdd",
15+
"linode_label": null
1316
},
1417
{
1518
"id": 2,
@@ -20,7 +23,10 @@
2023
"size": 100,
2124
"updated": "2017-08-07T04:00:00",
2225
"status": "active",
23-
"tags": []
26+
"tags": [],
27+
"filesystem_path": "this/is/a/file/path",
28+
"hardware_type": "nvme",
29+
"linode_label": null
2430
},
2531
{
2632
"id": 3,
@@ -31,7 +37,10 @@
3137
"size": 200,
3238
"updated": "2017-08-07T04:00:00",
3339
"status": "active",
34-
"tags": ["attached"]
40+
"tags": ["attached"],
41+
"filesystem_path": "this/is/a/file/path",
42+
"hardware_type": "nvme",
43+
"linode_label": "some_label"
3544
}
3645
],
3746
"results": 3,

test/linode_client_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ def test_get_volumes(self):
115115
self.assertEqual(v[1].size, 100)
116116
self.assertEqual(v[2].size, 200)
117117
self.assertEqual(v[2].label, 'block3')
118+
self.assertEqual(v[0].filesystem_path, 'this/is/a/file/path')
119+
self.assertEqual(v[0].hardware_type, 'hdd')
120+
self.assertEqual(v[1].filesystem_path, 'this/is/a/file/path')
121+
self.assertEqual(v[1].linode_label, None)
122+
self.assertEqual(v[2].filesystem_path, 'this/is/a/file/path')
123+
self.assertEqual(v[2].hardware_type, 'nvme')
118124

119125
assert v[0].tags == ["something"]
120126
assert v[1].tags == []

test/objects/volume_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def test_get_volume(self):
2727

2828
assert volume.tags == ["something"]
2929

30+
self.assertEqual(volume.filesystem_path, 'this/is/a/file/path')
31+
self.assertEqual(volume.hardware_type, 'hdd')
32+
self.assertEqual(volume.linode_label, None)
33+
3034
def test_update_volume_tags(self):
3135
"""
3236
Tests that updating tags on an entity send the correct request

0 commit comments

Comments
 (0)