Skip to content

Commit

Permalink
test(core): fix factories (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
sumit4613 authored Sep 25, 2022
1 parent c34388e commit e507dd5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions shynet/core/factories.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
from django.contrib.auth import get_user_model
import factory
from django.contrib.auth import get_user_model
from factory import post_generation
from factory.django import DjangoModelFactory

from .models import Service


class UserFactory(DjangoModelFactory):
username = factory.Faker("user_name")
email = factory.Faker("email")
name = factory.Faker("name")
first_name = factory.Faker("name")

@post_generation
def password(self, create, extracted, **kwargs):
password = (
extracted
if extracted
else factory.Faker(
or factory.Faker(
"password",
length=42,
special_chars=True,
Expand All @@ -23,6 +24,7 @@ def password(self, create, extracted, **kwargs):
lower_case=True,
).evaluate(None, None, extra={"locale": None})
)

self.set_password(password)

class Meta:
Expand Down

0 comments on commit e507dd5

Please sign in to comment.