Add fixtures.

Create fixtures for kfet application:
- Add a bunch of non-cof profiles whose "last_name" is "Romain";
- Add k-fet articles using the real ones as a template;
- Add LIQ account;
- Add groups K-fet Chef and K-fet Girl;
- Add "caisse".
We also added some template for future tests (well, actually it's the script
used to generate the fixtures…).
This commit is contained in:
Michele Orrù 2017-01-03 01:17:49 +01:00 committed by Qwann
parent 5877218af5
commit 76db0c86a3
5 changed files with 9158 additions and 1406 deletions

File diff suppressed because it is too large Load diff

1178
kfet/fixtures/accounts.json Normal file

File diff suppressed because it is too large Load diff

2322
kfet/fixtures/articles.json Normal file

File diff suppressed because it is too large Load diff

98
kfet/fixtures/groups.json Normal file
View file

@ -0,0 +1,98 @@
[
{
"model": "auth.group",
"pk": 1,
"fields": {
"name": "K-F\u00eat chef",
"permissions": [
115,
116,
117,
118,
119,
120,
133,
134,
135,
130,
131,
132,
136,
137,
138,
121,
122,
123,
127,
128,
129,
124,
125,
126,
188,
189,
190,
169,
176,
183,
170,
171,
182,
172,
178,
177,
181,
175,
179,
173,
174,
184,
180,
139,
140,
141,
142,
143,
144,
166,
167,
168,
163,
164,
165,
151,
152,
153,
154,
155,
156,
185,
186,
187,
145,
146,
147,
148,
149,
150,
160,
161,
162,
157,
158,
159
]
}
},
{
"model": "auth.group",
"pk": 2,
"fields": {
"name": "K-F\u00eat girl",
"permissions": [
172,
173
]
}
}
]

View file

@ -3,7 +3,142 @@
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django.test import TestCase
# Create your tests here.
from kfet.models import Account
from gestioncof.models import CofProfile, User
names = ['Abelardus',
'Abrahamus',
'Acacius',
'Accius',
'Achaicus',
'Achill',
'Achilles',
'Achilleus',
'Acrisius',
'Actaeon',
'Acteon',
'Adalricus',
'Adelfonsus',
'Adelphus',
'Adeodatus',
'Adolfus',
'Adolphus',
'Adrastus',
'Adrianus',
'Ægidius',
'Ælia',
'Ælianus',
'Æmilianus',
'Æmilius',
'Aeneas',
'Æolus',
'Æschylus',
'Æson',
'Æsop',
'Æther',
'Ætius',
'Agapetus',
'Agapitus',
'Agapius',
'Agathangelus',
'Aigidius',
'Aiolus',
'Ajax',
'Alair',
'Alaricus',
'Albanus',
'Alberic',
'Albericus',
'Albertus',
'Albinus',
'Albus',
'Alcaeus',
'Alcander',
'Alcimus',
'Alcinder',
'Alerio',
'Alexandrus',
'Alexis',
'Alexius',
'Alexus',
'Alfonsus',
'Alfredus',
'Almericus',
'Aloisius',
'Aloysius',
'Alphaeus',
'Alpheaus',
'Alpheus',
'Alphoeus',
'Alphonsus',
'Alphonzus',
'Alvinius',
'Alvredus',
'Amadeus',
'Amaliricus',
'Amandus',
'Amantius',
'Amarandus',
'Amaranthus',
'Amatus',
'Ambrosianus',
'Ambrosius',
'Amedeus',
'Americus',
'Amlethus',
'Amletus',
'Amor',
'Ampelius',
'Amphion',
'Anacletus',
'Anastasius',
'Anastatius',
'Anastius',
'Anatolius',
'Androcles',
'Andronicus',
'Anencletus',
'Angelicus',
'Angelus',
'Anicetus',
'Antigonus',
'Antipater',
'Antoninus',
'Antonius',
'Aphrodisius',
'Apollinaris']
class TestFoo(TestCase):
fixtures = ['users', 'sites', 'gestion', 'articles']
def test_foo(self):
pass
# for name in names:
# user = User(username=name,
# last_name='Romain',
# first_name=name)
# user.email = '{}.{}@ens.fr'.format(user.first_name, user.last_name)
# user.save()
# galois_trigrammes = map('{:03d}'.format, range(40))
# galois = CofProfile.objects.filter(user__last_name='Gaulois')
# romains_trigrammes = map(lambda x: str(100+x), range(40))
# romains = CofProfile.objects.filter(user__last_name='Romain')
# for t, c in zip(galois_trigrammes, galois):
# Account.objects.create(cofprofile=c, trigramme=t)
# for t, c in zip(romains_trigrammes, romains):
# Account.objects.create(cofprofile=c, trigramme=t)
# class TestBar(TestCase):
# fixtures = ['users', 'sites', 'gestion', 'articles', 'groups', 'accounts']
# def test_foo(self):
# pass