forked from open-formulieren/open-forms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[maykinmedia/open-producten#24] Add tests
- Loading branch information
Showing
33 changed files
with
1,625 additions
and
1,119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,992 changes: 1,098 additions & 894 deletions
1,992
src/openforms/conf/locale/nl/LC_MESSAGES/django.po
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
PRICE_OPTION_KEY = "productPrice" | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import factory.fuzzy | ||
|
||
from openforms.products.tests.factories import ProductFactory | ||
|
||
from ..models import Price, PriceOption | ||
|
||
|
||
class PriceFactory(factory.django.DjangoModelFactory): | ||
uuid = factory.Faker("uuid4") | ||
valid_from = factory.Faker("date") | ||
product_type = factory.SubFactory(ProductFactory) | ||
|
||
class Meta: | ||
model = Price | ||
|
||
|
||
class PriceOptionFactory(factory.django.DjangoModelFactory): | ||
uuid = factory.Faker("uuid4") | ||
description = factory.Faker("sentence") | ||
amount = factory.fuzzy.FuzzyDecimal(1, 10) | ||
price = factory.SubFactory(PriceFactory) | ||
|
||
class Meta: | ||
model = PriceOption |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from datetime import date | ||
|
||
from ..api_models import Price, PriceOption, ProductType | ||
|
||
|
||
def create_price_option(uuid): | ||
return PriceOption( | ||
id=uuid, | ||
amount="10.00", | ||
description="description", | ||
) | ||
|
||
|
||
def create_price(price_uuid, option_uuid): | ||
return Price( | ||
id=price_uuid, | ||
valid_from=date.today(), | ||
options=[ | ||
create_price_option(option_uuid).__dict__ | ||
], # __dict__ is needed for zgw_consumers.api_models.Model _type_cast | ||
) | ||
|
||
|
||
def create_product_type(product_uuid, price_uuid, option_uuid): | ||
return ProductType( | ||
id=product_uuid, | ||
current_price=create_price(price_uuid, option_uuid), | ||
upl_uri="http://standaarden.overheid.nl/owms/terms/AangifteVertrekBuitenland", | ||
upl_name="aangifte vertrek buitenland", | ||
name="aangifte vertrek buitenland", | ||
) |
Oops, something went wrong.