Populate account table
[vagrant-mail.git] / database / platal / management / commands / fake_email_accounts.py
CommitLineData
e0a096ae
NI
1# -*- coding: utf-8 -*-
2#***************************************************************************
3#* Copyright (C) 2015 Polytechnique.org *
4#* http://opensource.polytechnique.org/ *
5#* *
6#* This program is free software; you can redistribute it and/or modify *
7#* it under the terms of the GNU General Public License as published by *
8#* the Free Software Foundation; either version 2 of the License, or *
9#* (at your option) any later version. *
10#* *
11#* This program is distributed in the hope that it will be useful, *
12#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14#* GNU General Public License for more details. *
15#* *
16#* You should have received a copy of the GNU General Public License *
17#* along with this program; if not, write to the Free Software *
18#* Foundation, Inc., *
19#* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20#***************************************************************************/
d171e6c7 21"""Create fake email accounts in the database for testing purpose"""
e0a096ae
NI
22from __future__ import unicode_literals
23
d171e6c7
NI
24from django.core.management.base import BaseCommand
25from ... import factories, models
e0a096ae 26
d171e6c7
NI
27
28class Command(BaseCommand):
29 help = "Create fake email accounts in the database"
30
31 def handle(self, *args, **options):
32 # Remove every account from the database
33 models.Account.objects.all().delete()
34
35 # Create several accounts
36 for i in range(20):
37 account = factories.AccountFactory.create()