Skip to content

Commit

Permalink
fix unsafe test call
Browse files Browse the repository at this point in the history
  • Loading branch information
devkral committed Feb 6, 2025
1 parent 9e95d78 commit 4560d45
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions tests/factory/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import edgy
from edgy.testing import DatabaseTestClient
from edgy.testing.exceptions import ExcludeValue
from edgy.testing.factory import FactoryField, ModelFactory, ModelFactoryContext
from edgy.testing.factory import FactoryField, ModelFactory
from edgy.testing.factory.base import ModelFactoryContextImplementation
from edgy.testing.factory.metaclasses import DEFAULT_MAPPING
from tests.settings import DATABASE_URL

Expand Down Expand Up @@ -341,27 +342,33 @@ class Meta:
}:
DEFAULT_MAPPING[field_type_name](
ProductFactory.meta.fields["user"],
ModelFactoryContext(
ModelFactoryContextImplementation(
faker=ProductFactory.meta.faker,
exclude_autoincrement=ProductFactory.exclude_autoincrement,
depth=0,
callcounts={},
),
{},
)
elif field_type_name == "ChoiceField":
DEFAULT_MAPPING[field_type_name](
ProductFactory.meta.fields["type"],
ModelFactoryContext(
ModelFactoryContextImplementation(
faker=ProductFactory.meta.faker,
exclude_autoincrement=ProductFactory.exclude_autoincrement,
depth=0,
callcounts={},
),
{},
)
elif field_type_name == "RefForeignKey":
DEFAULT_MAPPING[field_type_name](
UserFactory.meta.fields["product_ref"],
ModelFactoryContext(
ModelFactoryContextImplementation(
faker=UserFactory.meta.faker,
exclude_autoincrement=UserFactory.exclude_autoincrement,
depth=0,
callcounts={},
),
{},
)
Expand All @@ -370,9 +377,11 @@ class Meta:
if callback:
callback(
UserFactory.meta.fields["name"],
ModelFactoryContext(
ModelFactoryContextImplementation(
faker=UserFactory.meta.faker,
exclude_autoincrement=UserFactory.exclude_autoincrement,
depth=0,
callcounts={},
),
{},
)

0 comments on commit 4560d45

Please sign in to comment.