-
Notifications
You must be signed in to change notification settings - Fork 32
/
__init__.py
44 lines (39 loc) · 1.4 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# coding=utf-8
from elections.tests import VotaInteligenteTestCase as TestCase
from django.contrib.auth.models import User
from elections.models import Area
from popular_proposal.forms.forms import wizard_forms_fields
from django import forms
example_fields = {
'CharField': 'fieraFeroz',
'URLField': 'http://fieraFeroz.com',
'BooleanField': True,
}
def get_example_data_for_testing():
data = {}
for step in wizard_forms_fields:
for f in step['fields']:
if f == "is_testing":
data[f] = False
continue
field = step['fields'][f]
field_type = field.__class__.__name__
if field_type in example_fields:
data[f] = example_fields[field_type]
elif field_type == 'ChoiceField':
data[f] = field.choices[-1][0]
return data
class ProposingCycleTestCaseBase(TestCase):
def setUp(self):
super(ProposingCycleTestCaseBase, self).setUp()
self.fiera = User.objects.get(username='fiera')
self.feli = User.objects.get(username='feli')
self.arica = Area.objects.get(id='arica-15101')
self.alhue = Area.objects.get(id='alhue-13502')
self.data = get_example_data_for_testing()
self.comments = {
'title': '',
'problem': '',
'when': u'El plazo no está tan bueno',
'causes': ''
}