@@ -131,29 +131,107 @@ def test_volume_detail(self):
131131 '# of Active Transactions' : '0'
132132 }, json .loads (result .output ))
133133
134+ def test_volume_order_performance_iops_not_given (self ):
135+ result = self .run_command (['file' , 'volume-order' ,
136+ '--storage-type=performance' , '--size=20' ,
137+ '--os-type=linux' , '--location=dal05' ])
138+
139+ self .assertEqual (2 , result .exit_code )
140+
141+ def test_volume_order_performance_iops_out_of_range (self ):
142+ result = self .run_command (['file' , 'volume-order' ,
143+ '--storage-type=performance' , '--size=20' ,
144+ '--iops=80000' , '--os-type=linux' ,
145+ '--location=dal05' ])
146+
147+ self .assertEqual (2 , result .exit_code )
148+
149+ def test_volume_order_performance_iops_not_multiple_of_100 (self ):
150+ result = self .run_command (['file' , 'volume-order' ,
151+ '--storage-type=performance' , '--size=20' ,
152+ '--iops=122' , '--os-type=linux' ,
153+ '--location=dal05' ])
154+
155+ self .assertEqual (2 , result .exit_code )
156+
157+ def test_volume_order_performance_snapshot_error (self ):
158+ result = self .run_command (['file' , 'volume-order' ,
159+ '--storage-type=performance' , '--size=20' ,
160+ '--iops=100' , '--os-type=linux' ,
161+ '--location=dal05' , '--snapshot-size=10' ])
162+
163+ self .assertEqual (2 , result .exit_code )
164+
165+ @mock .patch ('SoftLayer.FileStorageManager.order_file_volume' )
166+ def test_volume_order_performance (self , order_mock ):
167+ order_mock .return_value = {
168+ 'placedOrder' : {
169+ 'id' : 478 ,
170+ 'items' : [
171+ {'description' : 'Performance Storage' },
172+ {'description' : 'File Storage' },
173+ {'description' : '0.25 IOPS per GB' },
174+ {'description' : '20 GB Storage Space' }]
175+ }
176+ }
177+
178+ result = self .run_command (['file' , 'volume-order' ,
179+ '--storage-type=performance' , '--size=20' ,
180+ '--iops=100' , '--os-type=linux' ,
181+ '--location=dal05' ])
182+
183+ self .assert_no_fail (result )
184+ self .assertEqual (result .output ,
185+ 'Order #478 placed successfully!\n '
186+ ' > Performance Storage\n > File Storage\n '
187+ ' > 0.25 IOPS per GB\n > 20 GB Storage Space\n ' )
188+
189+ def test_volume_order_endurance_tier_not_given (self ):
190+ result = self .run_command (['file' , 'volume-order' ,
191+ '--storage-type=endurance' , '--size=20' ,
192+ '--os-type=linux' , '--location=dal05' ])
193+
194+ self .assertEqual (2 , result .exit_code )
195+
134196 @mock .patch ('SoftLayer.FileStorageManager.order_file_volume' )
135- def test_volume_order (self , order_mock ):
197+ def test_volume_order_endurance (self , order_mock ):
136198 order_mock .return_value = {
137199 'placedOrder' : {
138200 'id' : 478 ,
139- 'items' : [{'description' : 'Endurance Storage' },
140- {'description' : 'File Storage' },
141- {'description' : '0.25 IOPS per GB' },
142- {'description' : '20 GB Storage Space' },
143- ]
201+ 'items' : [
202+ {'description' : 'Endurance Storage' },
203+ {'description' : 'File Storage' },
204+ {'description' : '0.25 IOPS per GB' },
205+ {'description' : '20 GB Storage Space' },
206+ {'description' : '10 GB Storage Space (Snapshot Space)' }]
144207 }
145208 }
146209
147210 result = self .run_command (['file' , 'volume-order' ,
148211 '--storage-type=endurance' , '--size=20' ,
149212 '--tier=0.25' , '--os-type=linux' ,
150- '--location=dal05' ])
213+ '--location=dal05' , '--snapshot-size=10' ])
151214
152215 self .assert_no_fail (result )
153216 self .assertEqual (result .output ,
154217 'Order #478 placed successfully!\n '
155218 ' > Endurance Storage\n > File Storage\n '
156- ' > 0.25 IOPS per GB\n > 20 GB Storage Space\n ' )
219+ ' > 0.25 IOPS per GB\n > 20 GB Storage Space\n '
220+ ' > 10 GB Storage Space (Snapshot Space)\n ' )
221+
222+ @mock .patch ('SoftLayer.FileStorageManager.order_file_volume' )
223+ def test_volume_order_order_not_placed (self , order_mock ):
224+ order_mock .return_value = {}
225+
226+ result = self .run_command (['file' , 'volume-order' ,
227+ '--storage-type=endurance' , '--size=20' ,
228+ '--tier=0.25' , '--os-type=linux' ,
229+ '--location=dal05' ])
230+
231+ self .assert_no_fail (result )
232+ self .assertEqual (result .output ,
233+ 'Order could not be placed! Please verify '
234+ 'your options and try again.\n ' )
157235
158236 def test_enable_snapshots (self ):
159237 result = self .run_command (['file' , 'snapshot-enable' , '12345678' ,
0 commit comments