Skip to content
Snippets Groups Projects
Commit 34ccd667 authored by Nicolas Mérigot's avatar Nicolas Mérigot
Browse files

Merge branch 'feature/factory' into 'master'

Feature: add user factory in dev flavor

Closes #66

See merge request startinblox/djangoldp-packages/djangoldp!9
parents b8255e7e a4deb006
No related branches found
No related tags found
No related merge requests found
import factory
from django.contrib.auth.models import User
from django.db.models.signals import post_save
@factory.django.mute_signals(post_save)
class UserFactory(factory.django.DjangoModelFactory):
class Meta:
model = User
username = factory.Faker('user_name')
first_name = factory.Faker('first_name')
last_name = factory.Faker('last_name')
email = factory.Faker('email')
password = factory.PostGenerationMethodCall('set_password', 'totototo')
from django.core.management.base import BaseCommand, CommandError
from djangoldp.factories import UserFactory
class Command(BaseCommand):
help = 'Mock data'
def add_arguments(self, parser):
parser.add_argument('--size', type=int, default=0, help='Number of user to create')
def handle(self, *args, **options):
UserFactory.create_batch(size=options['size']);
self.stdout.write(self.style.SUCCESS('Successful data mock install'))
...@@ -8,9 +8,7 @@ description = Linked Data Platform interface for Django Rest Framework ...@@ -8,9 +8,7 @@ description = Linked Data Platform interface for Django Rest Framework
license = MIT license = MIT
[options] [options]
packages = packages = find:
djangoldp
djangoldp.migrations
setup_requires = setup_requires =
django~=1.11 django~=1.11
install_requires = install_requires =
...@@ -19,6 +17,10 @@ install_requires = ...@@ -19,6 +17,10 @@ install_requires =
pyld pyld
django-guardian django-guardian
[options.extras_require]
dev =
factory_boy>=2.11.0
[semantic_release] [semantic_release]
version_source = tag version_source = tag
version_variable = djangoldp/__init__.py:__version__ version_variable = djangoldp/__init__.py:__version__
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment