File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,9 @@ class ProductResource(OscarCatalogueResource):
102102 id : Optional [int ]
103103 code : Optional [str ]
104104 upc : Optional [str ]
105- structure : Optional [str ] = StringField (choices = ProductModel .STRUCTURE_CHOICES )
105+ structure : Optional [str ] = StringField (
106+ choices = ProductModel .STRUCTURE_CHOICES , null = True
107+ )
106108 title : Optional [str ]
107109 slug : Optional [str ]
108110 description : Optional [str ] = ""
Original file line number Diff line number Diff line change 2727 PRODUCT_TITLE ,
2828 PRODUCT_UPC ,
2929 PRODUCT_DESCRIPTION ,
30+ PRODUCT_IS_DISCOUNTABLE ,
3031 PRODUCTCLASS_REQUIRESSHIPPING ,
3132 MODEL_IDENTIFIERS_MAPPING ,
3233)
@@ -240,14 +241,10 @@ def test_resource_default_value(self):
240241 prd = Product .objects .get (upc = "1234" )
241242 self .assertEqual (prd .is_discountable , False )
242243
243- product_resource = ProductResource (
244- upc = "1234" ,
245- title = "bat" ,
246- slug = "asdf" ,
247- structure = Product .STANDALONE ,
248- product_class = product_class ,
244+ product_resource = ProductResource (upc = "1234" , is_discountable = True )
245+ _ , errors = products_to_db (
246+ product_resource , fields_to_update = [PRODUCT_IS_DISCOUNTABLE ]
249247 )
250- _ , errors = products_to_db (product_resource )
251248 self .assertEqual (len (errors ), 0 )
252249 prd .refresh_from_db ()
253250 # Default value of is_discountable is considered from the ProductResource
You can’t perform that action at this time.
0 commit comments