@@ -237,6 +237,10 @@ def test_cancel_metal_on_anniversary(self):
237237
238238 def test_cancel_hardware_without_reason (self ):
239239 hw_id = 987
240+ self .client ['Hardware_Server' ].getObject .return_value = {
241+ 'id' : hw_id ,
242+ 'bareMetalInstanceFlag' : False ,
243+ }
240244 result = self .hardware .cancel_hardware (hw_id )
241245
242246 reasons = self .hardware .get_cancellation_reasons ()
@@ -250,6 +254,11 @@ def test_cancel_hardware_with_reason_and_comment(self):
250254 reason = 'sales'
251255 comment = 'Test Comment'
252256
257+ self .client ['Hardware_Server' ].getObject .return_value = {
258+ 'id' : hw_id ,
259+ 'bareMetalInstanceFlag' : False ,
260+ }
261+
253262 self .hardware .cancel_hardware (hw_id , reason , comment )
254263
255264 reasons = self .hardware .get_cancellation_reasons ()
@@ -258,6 +267,14 @@ def test_cancel_hardware_with_reason_and_comment(self):
258267 f .assert_called_once_with (hw_id , reasons [reason ], comment , True ,
259268 'HARDWARE' )
260269
270+ def test_cancel_hardware_on_bmc (self ):
271+ hw_id = 6327
272+
273+ result = self .hardware .cancel_hardware (hw_id )
274+ f = self .client ['Billing_Item' ].cancelServiceOnAnniversaryDate
275+ f .assert_called_once_with (id = hw_id )
276+ self .assertEqual (result , Billing_Item .cancelServiceOnAnniversaryDate )
277+
261278 def test_change_port_speed_public (self ):
262279 hw_id = 1
263280 speed = 100
@@ -277,8 +294,20 @@ def test_change_port_speed_private(self):
277294 def test_get_available_dedicated_server_packages (self ):
278295 self .hardware .get_available_dedicated_server_packages ()
279296
280- f = self .client ['Product_Package' ].getObject
281- f .assert_has_calls ([call (id = 13 , mask = 'mask[id, name, description]' )])
297+ filter_mock = {
298+ 'type' : {
299+ 'keyName' : {
300+ 'operation' : 'in' ,
301+ 'options' : [{
302+ 'name' : 'data' ,
303+ 'value' : ['BARE_METAL_CPU' ]
304+ }]
305+ }
306+ }
307+ }
308+ f = self .client ['Product_Package' ].getAllObjects
309+ f .assert_has_calls ([call (mask = 'id,name,description,type' ,
310+ filter = filter_mock )])
282311
283312 def test_get_dedicated_server_options (self ):
284313 package_id = 13
0 commit comments