@@ -283,30 +283,33 @@ def test_get_preset_by_key_preset_not_found(self):
283283 self .assertEqual ('Preset {} does not exist in package {}' .format (keyname , 'PACKAGE_KEYNAME' ), str (exc ))
284284
285285 def test_get_price_id_list (self ):
286- price1 = {'id' : 1234 , 'locationGroupId' : None }
287- item1 = {'id' : 1111 , 'keyName' : 'ITEM1' , 'prices' : [price1 ]}
288- price2 = {'id' : 5678 , 'locationGroupId' : None }
289- item2 = {'id' : 2222 , 'keyName' : 'ITEM2' , 'prices' : [price2 ]}
286+ category1 = {'categoryCode' : 'cat1' }
287+ price1 = {'id' : 1234 , 'locationGroupId' : None , 'itemCategory' : [category1 ]}
288+ item1 = {'id' : 1111 , 'keyName' : 'ITEM1' , 'itemCategory' : category1 , 'prices' : [price1 ]}
289+ category2 = {'categoryCode' : 'cat2' }
290+ price2 = {'id' : 5678 , 'locationGroupId' : None , 'categories' : [category2 ]}
291+ item2 = {'id' : 2222 , 'keyName' : 'ITEM2' , 'itemCategory' : category2 , 'prices' : [price2 ]}
290292
291293 with mock .patch .object (self .ordering , 'list_items' ) as list_mock :
292294 list_mock .return_value = [item1 , item2 ]
293295
294296 prices = self .ordering .get_price_id_list ('PACKAGE_KEYNAME' , ['ITEM1' , 'ITEM2' ])
295297
296- list_mock .assert_called_once_with ('PACKAGE_KEYNAME' , mask = 'id, keyName, prices' )
298+ list_mock .assert_called_once_with ('PACKAGE_KEYNAME' , mask = 'id, itemCategory, keyName, prices[categories] ' )
297299 self .assertEqual ([price1 ['id' ], price2 ['id' ]], prices )
298300
299301 def test_get_price_id_list_item_not_found (self ):
300- price1 = {'id' : 1234 , 'locationGroupId' : '' }
301- item1 = {'id' : 1111 , 'keyName' : 'ITEM1' , 'prices' : [price1 ]}
302+ category1 = {'categoryCode' : 'cat1' }
303+ price1 = {'id' : 1234 , 'locationGroupId' : '' , 'categories' : [category1 ]}
304+ item1 = {'id' : 1111 , 'keyName' : 'ITEM1' , 'itemCategory' : category1 , 'prices' : [price1 ]}
302305
303306 with mock .patch .object (self .ordering , 'list_items' ) as list_mock :
304307 list_mock .return_value = [item1 ]
305308
306309 exc = self .assertRaises (exceptions .SoftLayerError ,
307310 self .ordering .get_price_id_list ,
308311 'PACKAGE_KEYNAME' , ['ITEM2' ])
309- list_mock .assert_called_once_with ('PACKAGE_KEYNAME' , mask = 'id, keyName, prices' )
312+ list_mock .assert_called_once_with ('PACKAGE_KEYNAME' , mask = 'id, itemCategory, keyName, prices[categories] ' )
310313 self .assertEqual ("Item ITEM2 does not exist for package PACKAGE_KEYNAME" , str (exc ))
311314
312315 def test_generate_no_complex_type (self ):
@@ -460,30 +463,34 @@ def test_get_location_id_int(self):
460463
461464 def test_location_group_id_none (self ):
462465 # RestTransport uses None for empty locationGroupId
463- price1 = {'id' : 1234 , 'locationGroupId' : None }
464- item1 = {'id' : 1111 , 'keyName' : 'ITEM1' , 'prices' : [price1 ]}
465- price2 = {'id' : 5678 , 'locationGroupId' : None }
466- item2 = {'id' : 2222 , 'keyName' : 'ITEM2' , 'prices' : [price2 ]}
466+ category1 = {'categoryCode' : 'cat1' }
467+ price1 = {'id' : 1234 , 'locationGroupId' : None , 'categories' : [category1 ]}
468+ item1 = {'id' : 1111 , 'keyName' : 'ITEM1' , 'itemCategory' : category1 , 'prices' : [price1 ]}
469+ category2 = {'categoryCode' : 'cat2' }
470+ price2 = {'id' : 5678 , 'locationGroupId' : None , 'categories' : [category2 ]}
471+ item2 = {'id' : 2222 , 'keyName' : 'ITEM2' , 'itemCategory' : category2 , 'prices' : [price2 ]}
467472
468473 with mock .patch .object (self .ordering , 'list_items' ) as list_mock :
469474 list_mock .return_value = [item1 , item2 ]
470475
471476 prices = self .ordering .get_price_id_list ('PACKAGE_KEYNAME' , ['ITEM1' , 'ITEM2' ])
472477
473- list_mock .assert_called_once_with ('PACKAGE_KEYNAME' , mask = 'id, keyName, prices' )
478+ list_mock .assert_called_once_with ('PACKAGE_KEYNAME' , mask = 'id, itemCategory, keyName, prices[categories] ' )
474479 self .assertEqual ([price1 ['id' ], price2 ['id' ]], prices )
475480
476481 def test_location_groud_id_empty (self ):
477482 # XMLRPCtransport uses '' for empty locationGroupId
478- price1 = {'id' : 1234 , 'locationGroupId' : '' }
479- item1 = {'id' : 1111 , 'keyName' : 'ITEM1' , 'prices' : [price1 ]}
480- price2 = {'id' : 5678 , 'locationGroupId' : "" }
481- item2 = {'id' : 2222 , 'keyName' : 'ITEM2' , 'prices' : [price2 ]}
483+ category1 = {'categoryCode' : 'cat1' }
484+ price1 = {'id' : 1234 , 'locationGroupId' : '' , 'categories' : [category1 ]}
485+ item1 = {'id' : 1111 , 'keyName' : 'ITEM1' , 'itemCategory' : category1 , 'prices' : [price1 ]}
486+ category2 = {'categoryCode' : 'cat2' }
487+ price2 = {'id' : 5678 , 'locationGroupId' : "" , 'categories' : [category2 ]}
488+ item2 = {'id' : 2222 , 'keyName' : 'ITEM2' , 'itemCategory' : category2 , 'prices' : [price2 ]}
482489
483490 with mock .patch .object (self .ordering , 'list_items' ) as list_mock :
484491 list_mock .return_value = [item1 , item2 ]
485492
486493 prices = self .ordering .get_price_id_list ('PACKAGE_KEYNAME' , ['ITEM1' , 'ITEM2' ])
487494
488- list_mock .assert_called_once_with ('PACKAGE_KEYNAME' , mask = 'id, keyName, prices' )
495+ list_mock .assert_called_once_with ('PACKAGE_KEYNAME' , mask = 'id, itemCategory, keyName, prices[categories] ' )
489496 self .assertEqual ([price1 ['id' ], price2 ['id' ]], prices )
0 commit comments