forked from softlayer/softlayer-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoscale_tests.py
More file actions
125 lines (97 loc) · 3.28 KB
/
autoscale_tests.py
File metadata and controls
125 lines (97 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
"""
SoftLayer.tests.managers.autoscale_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
from SoftLayer.managers.autoscale import AutoScaleManager
from SoftLayer import testing
class AutoScaleTests(testing.TestCase):
def set_up(self):
self.autoscale = AutoScaleManager(self.client)
def test_autoscale_list(self):
self.autoscale.list()
self.assert_called_with(
'SoftLayer_Account',
'getScaleGroups'
)
def test_autoscale_list_with_mask(self):
self.autoscale.list(mask='mask[status,virtualGuestMemberCount]')
self.assert_called_with(
'SoftLayer_Account',
'getScaleGroups'
)
def test_autoscale_details(self):
self.autoscale.details(11111)
self.assert_called_with(
'SoftLayer_Scale_Group',
'getObject',
identifier=11111
)
def test_autoscale_details_with_mask(self):
self.autoscale.details(11111, mask='mask[virtualGuestMembers[id,virtualGuest[hostname,domain,provisionDate]], '
'terminationPolicy,virtualGuestMemberCount]')
self.assert_called_with(
'SoftLayer_Scale_Group',
'getObject',
identifier=11111
)
def test_autoscale_policy(self):
self.autoscale.get_policy(11111)
self.assert_called_with(
'SoftLayer_Scale_Policy',
'getObject',
identifier=11111
)
def test_autoscale_policy_with_mask(self):
self.autoscale.get_policy(11111, mask='mask[cooldown, createDate, id, name, actions, triggers[type]]')
self.assert_called_with(
'SoftLayer_Scale_Policy',
'getObject',
identifier=11111
)
def test_autoscale_scale(self):
self.autoscale.scale(11111, 3)
self.assert_called_with(
'SoftLayer_Scale_Group',
'scale',
identifier=11111
)
def test_autoscale_scaleTo(self):
self.autoscale.scale_to(11111, 3)
self.assert_called_with(
'SoftLayer_Scale_Group',
'scaleTo',
identifier=11111
)
def test_autoscale_getLogs(self):
self.autoscale.get_logs(11111)
self.assert_called_with(
'SoftLayer_Scale_Group',
'getLogs',
identifier=11111
)
def test_autoscale_get_virtual_guests(self):
self.autoscale.get_virtual_guests(11111)
self.assert_called_with(
'SoftLayer_Scale_Group',
'getVirtualGuestMembers',
identifier=11111,
mask=None
)
def test_autoscale_get_virtual_guests_mask(self):
test_mask = "mask[id]"
self.autoscale.get_virtual_guests(11111, mask=test_mask)
self.assert_called_with(
'SoftLayer_Scale_Group',
'getVirtualGuestMembers',
identifier=11111,
mask=test_mask
)
def test_edit_object(self):
template = {'name': 'test'}
self.autoscale.edit(12345, template)
self.assert_called_with(
'SoftLayer_Scale_Group',
'editObject',
args=(template,),
identifier=12345)