-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Issue #174] adjusted and added factories.
- Loading branch information
Showing
20 changed files
with
221 additions
and
46 deletions.
There are no files selected for viewing
Empty file.
14 changes: 14 additions & 0 deletions
14
koalixcrm/accounting/factories/factory_product_category.py
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,14 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import factory | ||
from koalixcrm.accounting.models import ProductCategory | ||
|
||
|
||
class StandardProductCategoryFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = ProductCategory | ||
django_get_or_create = ('title',) | ||
|
||
title = "Service" | ||
profit_account = "" | ||
loss_account = "" |
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,43 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import factory | ||
import datetime | ||
from koalixcrm.crm.models import Agreement | ||
from koalixcrm.crm.factories.factory_resource import StandardResourceFactory | ||
from koalixcrm.crm.factories.factory_human_resource import StandardHumanResourceFactory | ||
from koalixcrm.crm.factories.factory_task import StandardTaskFactory | ||
from koalixcrm.crm.factories.factory_unit import StandardUnitFactory | ||
from koalixcrm.crm.factories.factory_resource_price import StandardResourcePriceFactory | ||
from koalixcrm.crm.factories.factory_agreement_type import StandardAgreementTypeFactory | ||
from koalixcrm.crm.factories.factory_agreement_status import AgreedAgreementStatusFactory | ||
from koalixcrm.test_support_functions import make_date_utc | ||
|
||
|
||
class StandardAgreementToTaskFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = Agreement | ||
|
||
date_from = make_date_utc(datetime.datetime(2018, 6, 15, 00)) | ||
date_until = make_date_utc(datetime.datetime(2024, 6, 15, 00)) | ||
amount = "112.50" | ||
task = factory.SubFactory(StandardTaskFactory) | ||
resource = factory.SubFactory(StandardResourceFactory) | ||
unit = factory.SubFactory(StandardUnitFactory) | ||
status = factory.SubFactory(AgreedAgreementStatusFactory) | ||
costs = factory.SubFactory(StandardResourcePriceFactory) | ||
type = factory.SubFactory(StandardAgreementTypeFactory) | ||
|
||
|
||
class StandardHumanResourceAgreementToTaskFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = Agreement | ||
|
||
date_from = make_date_utc(datetime.datetime(2018, 6, 15, 00)) | ||
date_until = make_date_utc(datetime.datetime(2024, 6, 15, 00)) | ||
amount = "112.50" | ||
task = factory.SubFactory(StandardTaskFactory) | ||
resource = factory.SubFactory(StandardHumanResourceFactory) | ||
unit = factory.SubFactory(StandardUnitFactory) | ||
status = factory.SubFactory(AgreedAgreementStatusFactory) | ||
costs = factory.SubFactory(StandardResourcePriceFactory) | ||
type = factory.SubFactory(StandardAgreementTypeFactory) |
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,34 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import factory | ||
from koalixcrm.crm.models import AgreementStatus | ||
|
||
|
||
class AgreedAgreementStatusFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = AgreementStatus | ||
django_get_or_create = ('title',) | ||
|
||
title = "Done" | ||
description = "This agreement is agreed" | ||
is_agreed = True | ||
|
||
|
||
class PlannedAgreementStatusFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = AgreementStatus | ||
django_get_or_create = ('title',) | ||
|
||
title = "Planned" | ||
description = "This agreement is planned" | ||
is_agreed = False | ||
|
||
|
||
class StartedAgreementStatusFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = AgreementStatus | ||
django_get_or_create = ('title',) | ||
|
||
title = "Started" | ||
description = "This agreement is started" | ||
is_agreed = False |
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,12 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import factory | ||
from koalixcrm.crm.models import AgreementType | ||
|
||
|
||
class StandardAgreementTypeFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = AgreementType | ||
|
||
title = 'This is a test Agreement Type' | ||
description = "This is a description of such a Agreement Type" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import factory | ||
from koalixcrm.crm.models import EstimationStatus | ||
|
||
|
||
class ObsoleteEstimationStatusFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = EstimationStatus | ||
django_get_or_create = ('title',) | ||
|
||
title = "Done" | ||
description = "This estimation is obsolete" | ||
is_obsolete = True | ||
|
||
|
||
class PlannedEstimationStatusFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = EstimationStatus | ||
django_get_or_create = ('title',) | ||
|
||
title = "Planned" | ||
description = "This estimation is planned" | ||
is_obsolete = False | ||
|
||
|
||
class StartedEstimationStatusFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = EstimationStatus | ||
django_get_or_create = ('title',) | ||
|
||
title = "Started" | ||
description = "This estimation is started" | ||
is_obsolete = False |
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
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,18 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import factory | ||
from koalixcrm.crm.models import UnitTransform | ||
from koalixcrm.crm.factories.factory_unit import StandardUnitFactory, SmallUnitFactory | ||
from koalixcrm.crm.factories.factory_product_type import StandardProductTypeFactory | ||
|
||
|
||
class StandardUnitTransformFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = UnitTransform | ||
django_get_or_create = ('from_unit', | ||
'to_unit') | ||
|
||
from_unit = factory.SubFactory(StandardUnitFactory) | ||
to_unit = factory.SubFactory(SmallUnitFactory) | ||
product_type = factory.SubFactory(StandardProductTypeFactory) | ||
factor = 1.10 |
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
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
Oops, something went wrong.