@@ -640,12 +640,27 @@ def test_get_item_price_id_without_capacity_restriction(self):
640640
641641 self .assertEqual (1234 , price_id )
642642
643- def test_get_item_price_id_with_capacity_restriction (self ):
643+ def test_get_item_price_id_core_with_capacity_restriction (self ):
644644 category1 = {'categoryCode' : 'cat1' }
645645 price1 = [{'id' : 1234 , 'locationGroupId' : '' , "capacityRestrictionMaximum" : "16" ,
646- "capacityRestrictionMinimum" : "1" , 'categories' : [category1 ]},
646+ "capacityRestrictionMinimum" : "1" , "capacityRestrictionType" : "CORE" ,
647+ 'categories' : [category1 ]},
647648 {'id' : 2222 , 'locationGroupId' : '' , "capacityRestrictionMaximum" : "56" ,
648- "capacityRestrictionMinimum" : "36" , 'categories' : [category1 ]}]
649+ "capacityRestrictionMinimum" : "36" , "capacityRestrictionType" : "CORE" ,
650+ 'categories' : [category1 ]}]
651+
652+ price_id = self .ordering .get_item_price_id ("8" , price1 )
653+
654+ self .assertEqual (1234 , price_id )
655+
656+ def test_get_item_price_id_storage_with_capacity_restriction (self ):
657+ category1 = {'categoryCode' : 'cat1' }
658+ price1 = [{'id' : 1234 , 'locationGroupId' : '' , "capacityRestrictionMaximum" : "16" ,
659+ "capacityRestrictionMinimum" : "1" , "capacityRestrictionType" : "STORAGE_SPACE" ,
660+ 'categories' : [category1 ]},
661+ {'id' : 2222 , 'locationGroupId' : '' , "capacityRestrictionMaximum" : "56" ,
662+ "capacityRestrictionMinimum" : "36" , "capacityRestrictionType" : "STORAGE_SPACE" ,
663+ 'categories' : [category1 ]}]
649664
650665 price_id = self .ordering .get_item_price_id ("8" , price1 )
651666
@@ -696,7 +711,7 @@ def test_clean_quote_verify(self):
696711 self .assertNotIn ('testProperty' , order_container )
697712 self .assertNotIn ('reservedCapacityId' , order_container )
698713
699- def test_get_item_capacity (self ):
714+ def test_get_item_capacity_core (self ):
700715
701716 items = [{
702717 "capacity" : "1" ,
@@ -712,3 +727,20 @@ def test_get_item_capacity(self):
712727 item_capacity = self .ordering .get_item_capacity (items , ['GUEST_CORE_1_DEDICATED' , 'OS_RHEL_7_X_LAMP_64_BIT' ])
713728
714729 self .assertEqual (1 , int (item_capacity ))
730+
731+ def test_get_item_capacity_storage (self ):
732+
733+ items = [{
734+ "capacity" : "1" ,
735+ "id" : 6131 ,
736+ "keyName" : "STORAGE_SPACE_FOR_2_IOPS_PER_GB" ,
737+ },
738+ {
739+ "capacity" : "1" ,
740+ "id" : 10201 ,
741+ "keyName" : "READHEAVY_TIER" ,
742+ }]
743+
744+ item_capacity = self .ordering .get_item_capacity (items , ['READHEAVY_TIER' , 'STORAGE_SPACE_FOR_2_IOPS_PER_GB' ])
745+
746+ self .assertEqual (1 , int (item_capacity ))
0 commit comments