Faker is not imported anymore when the clean command is called

This commit is contained in:
Éloi Rivard 2023-03-13 09:46:17 +01:00
parent 965725fa6e
commit 7eef2748f2
2 changed files with 8 additions and 2 deletions

View file

@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_, The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_,
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_. and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.
Fixed
*****
- faker is not imported anymore when the `clean` command is called.
[0.0.21] - 2023-03-12 [0.0.21] - 2023-03-12
===================== =====================

View file

@ -7,8 +7,6 @@ from canaille.models import Group
from canaille.models import User from canaille.models import User
from canaille.oidc.models import AuthorizationCode from canaille.oidc.models import AuthorizationCode
from canaille.oidc.models import Token from canaille.oidc.models import Token
from canaille.populate import fake_groups
from canaille.populate import fake_users
from flask import current_app from flask import current_app
from flask.cli import FlaskGroup from flask.cli import FlaskGroup
from flask.cli import with_appcontext from flask.cli import with_appcontext
@ -118,6 +116,8 @@ if HAS_FAKER: # pragma: no branch
Populate the database with generated random users. Populate the database with generated random users.
""" """
from canaille.populate import fake_users
fake_users(ctx.obj["number"]) fake_users(ctx.obj["number"])
@populate.command() @populate.command()
@ -134,4 +134,6 @@ if HAS_FAKER: # pragma: no branch
Populate the database with generated random groups. Populate the database with generated random groups.
""" """
from canaille.populate import fake_groups
fake_groups(ctx.obj["number"], nb_users_max) fake_groups(ctx.obj["number"], nb_users_max)