Skip to content

Commit f2ecdb6

Browse files
Added missing mine field to StackScript class (#271)
## 📝 Description Added missing `mine` field to `StackScript` class ## ✔️ How to Test `pytest test` Ticket: TPT-1895
1 parent c26d1bc commit f2ecdb6

3 files changed

Lines changed: 52 additions & 1 deletion

File tree

linode_api4/objects/linode.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,6 +1460,7 @@ class StackScript(Base):
14601460
"deployments_total": Property(),
14611461
"description": Property(mutable=True),
14621462
"updated": Property(is_datetime=True),
1463+
"mine": Property(),
14631464
}
14641465

14651466
def _populate(self, json):
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"created": "2018-01-01T00:01:01",
3+
"deployments_active": 1,
4+
"deployments_total": 12,
5+
"description": "This StackScript installs and configures MySQL\n",
6+
"id": 10079,
7+
"images": [
8+
"linode/debian9",
9+
"linode/debian8"
10+
],
11+
"is_public": true,
12+
"label": "a-stackscript",
13+
"mine": true,
14+
"rev_note": "Set up MySQL",
15+
"script": "\"#!/bin/bash\"\n",
16+
"updated": "2018-01-01T00:01:01",
17+
"user_defined_fields": [
18+
{
19+
"default": null,
20+
"example": "hunter2",
21+
"label": "Enter the password",
22+
"manyOf": "avalue,anothervalue,thirdvalue",
23+
"name": "DB_PASSWORD",
24+
"oneOf": "avalue,anothervalue,thirdvalue"
25+
}
26+
],
27+
"user_gravatar_id": "a445b305abda30ebc766bc7fda037c37",
28+
"username": "myuser"
29+
}

test/objects/linode_test.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from datetime import datetime
22
from test.base import ClientBaseCase
33

4-
from linode_api4.objects import Config, Disk, Image, Instance, Type
4+
from linode_api4.objects import Config, Disk, Image, Instance, StackScript, Type
55

66

77
class LinodeTest(ClientBaseCase):
@@ -452,6 +452,27 @@ def test_get_config(self):
452452
self.assertIsNotNone(config.devices)
453453

454454

455+
class StackScriptTest(ClientBaseCase):
456+
"""
457+
Tests the methods of the StackScript class.
458+
"""
459+
460+
def test_get_stackscript(self):
461+
"""
462+
Tests that a stackscript is loaded correctly by ID
463+
"""
464+
stackscript = StackScript(self.client, 10079)
465+
466+
self.assertEqual(stackscript.id, 10079)
467+
self.assertEqual(stackscript.deployments_active, 1)
468+
self.assertEqual(stackscript.deployments_total, 12)
469+
self.assertEqual(stackscript.rev_note, "Set up MySQL")
470+
self.assertTrue(stackscript.mine)
471+
self.assertTrue(stackscript.is_public)
472+
self.assertIsNotNone(stackscript.user_defined_fields)
473+
self.assertIsNotNone(stackscript.images)
474+
475+
455476
class TypeTest(ClientBaseCase):
456477
def test_get_types(self):
457478
"""

0 commit comments

Comments
 (0)