Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
specialunderwear committed Dec 4, 2024
1 parent ec0b9e0 commit 433a6aa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions oscar_odin/mappings/catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ def product_class(self, value) -> ProductClassModel:
"description": {constants.PRODUCT_DESCRIPTION},
"is_discountable": {constants.PRODUCT_IS_DISCOUNTABLE},
"priority": {constants.PRODUCT_PRIORITY},
"code": {constants.PRODUCT_CODE},
}

@classmethod
Expand Down
1 change: 1 addition & 0 deletions oscar_odin/mappings/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
PRODUCT_STRUCTURE = "Product.structure"
PRODUCT_IS_PUBLIC = "Product.is_public"
PRODUCT_UPC = "Product.upc"
PRODUCT_CODE = "Product.code"
PRODUCT_PARENT = "Product.parent"
PRODUCT_TITLE = "Product.title"
PRODUCT_SLUG = "Product.slug"
Expand Down
4 changes: 4 additions & 0 deletions tests/mappings/test_catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def test_get_mapped_fields(self):
"attributes",
"categories",
"children",
"code",
"date_created",
"date_updated",
"description",
Expand Down Expand Up @@ -116,6 +117,7 @@ def test_get_mapped_fields(self):
"availability",
"categories",
"children",
"code",
"currency",
"date_created",
"date_updated",
Expand Down Expand Up @@ -148,6 +150,7 @@ def test_get_mapped_fields(self):
"attributes",
"categories",
"children",
"code",
"date_created",
"date_updated",
"description",
Expand Down Expand Up @@ -177,6 +180,7 @@ def test_get_mapped_fields(self):
sorted(demfields),
[
"Category.code",
"Product.code",
"Product.description",
"Product.is_discountable",
"Product.is_public",
Expand Down
2 changes: 2 additions & 0 deletions tests/reverse/test_catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def test_create_product_with_related_fields(self):

product_resource = ProductResource(
upc="1234323-2",
code="semek-mumtaz",
title="asdf2",
slug="asdf-asdfasdf2",
description="description",
Expand Down Expand Up @@ -125,6 +126,7 @@ def test_create_product_with_related_fields(self):

product_resource = ProductResource(
upc="1234323-2",
code="haind-berrit",
title="asdf2",
structure=Product.STANDALONE,
price=D("21.50"),
Expand Down

0 comments on commit 433a6aa

Please sign in to comment.