@@ -699,9 +699,16 @@ def setUpTestData(cls):
699
699
)
700
700
Manufacturer .objects .bulk_create (manufacturers )
701
701
702
+ platforms = (
703
+ Platform (name = 'Platform 1' , slug = 'platform-1' , manufacturer = manufacturers [0 ]),
704
+ Platform (name = 'Platform 2' , slug = 'platform-2' , manufacturer = manufacturers [1 ]),
705
+ Platform (name = 'Platform 3' , slug = 'platform-3' , manufacturer = manufacturers [2 ]),
706
+ )
707
+ Platform .objects .bulk_create (platforms )
708
+
702
709
device_types = (
703
- DeviceType (manufacturer = manufacturers [0 ], model = 'Model 1' , slug = 'model-1' , part_number = 'Part Number 1' , u_height = 1 , is_full_depth = True , front_image = 'front.png' , rear_image = 'rear.png' , weight = 10 , weight_unit = WeightUnitChoices .UNIT_POUND ),
704
- DeviceType (manufacturer = manufacturers [1 ], model = 'Model 2' , slug = 'model-2' , part_number = 'Part Number 2' , u_height = 2 , is_full_depth = True , subdevice_role = SubdeviceRoleChoices .ROLE_PARENT , airflow = DeviceAirflowChoices .AIRFLOW_FRONT_TO_REAR , weight = 20 , weight_unit = WeightUnitChoices .UNIT_POUND ),
710
+ DeviceType (manufacturer = manufacturers [0 ], default_platform = platforms [ 0 ], model = 'Model 1' , slug = 'model-1' , part_number = 'Part Number 1' , u_height = 1 , is_full_depth = True , front_image = 'front.png' , rear_image = 'rear.png' , weight = 10 , weight_unit = WeightUnitChoices .UNIT_POUND ),
711
+ DeviceType (manufacturer = manufacturers [1 ], default_platform = platforms [ 1 ], model = 'Model 2' , slug = 'model-2' , part_number = 'Part Number 2' , u_height = 2 , is_full_depth = True , subdevice_role = SubdeviceRoleChoices .ROLE_PARENT , airflow = DeviceAirflowChoices .AIRFLOW_FRONT_TO_REAR , weight = 20 , weight_unit = WeightUnitChoices .UNIT_POUND ),
705
712
DeviceType (manufacturer = manufacturers [2 ], model = 'Model 3' , slug = 'model-3' , part_number = 'Part Number 3' , u_height = 3 , is_full_depth = False , subdevice_role = SubdeviceRoleChoices .ROLE_CHILD , airflow = DeviceAirflowChoices .AIRFLOW_REAR_TO_FRONT , weight = 30 , weight_unit = WeightUnitChoices .UNIT_KILOGRAM ),
706
713
)
707
714
DeviceType .objects .bulk_create (device_types )
@@ -785,6 +792,13 @@ def test_manufacturer(self):
785
792
params = {'manufacturer' : [manufacturers [0 ].slug , manufacturers [1 ].slug ]}
786
793
self .assertEqual (self .filterset (params , self .queryset ).qs .count (), 2 )
787
794
795
+ def test_default_platform (self ):
796
+ platforms = Platform .objects .all ()[:2 ]
797
+ params = {'default_platform_id' : [platforms [0 ].pk , platforms [1 ].pk ]}
798
+ self .assertEqual (self .filterset (params , self .queryset ).qs .count (), 2 )
799
+ params = {'default_platform' : [platforms [0 ].slug , platforms [1 ].slug ]}
800
+ self .assertEqual (self .filterset (params , self .queryset ).qs .count (), 2 )
801
+
788
802
def test_has_front_image (self ):
789
803
params = {'has_front_image' : True }
790
804
self .assertEqual (self .filterset (params , self .queryset ).qs .count (), 1 )
0 commit comments