Skip to content

Commit

Permalink
Fixing broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Álvarez committed Jul 28, 2017
1 parent e9cf041 commit ea92f8a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 5 additions & 6 deletions popular_proposal/tests/__init__.py
Expand Up @@ -5,16 +5,15 @@
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 = {}

example_fields = {
'CharField': 'fieraFeroz',
'URLField': 'http://fieraFeroz.com',
'BooleanField': True,
}

for step in wizard_forms_fields:
for f in step['fields']:
if f == "is_testing":
Expand Down
7 changes: 6 additions & 1 deletion popular_proposal/tests/wizard_tests.py
Expand Up @@ -19,6 +19,7 @@
from constance.test import override_config
from django.test import override_settings
from constance import config
from popular_proposal.tests import example_fields

USER_PASSWORD = 'secr3t'

Expand All @@ -35,6 +36,7 @@ def get_example_data_for_post(self, **kwargs):
if field == "is_testing":
continue
field_type = step['fields'][field].__class__.__name__

if field_type in ['ChoiceField']:
test_response[cntr][str(cntr) + '-' + field] = step['fields'][field].choices[-1][0]
test_response[cntr][field] = step['fields'][field].choices[-1][0]
Expand All @@ -43,10 +45,13 @@ def get_example_data_for_post(self, **kwargs):
test_response[cntr][str(cntr) + '-' + field] = choice
test_response[cntr][field] = choice
elif field_dict:
help_text = field_dict.get('help_text', None)
help_text = example_fields.get(field_type, None)
if not help_text:
test_response[cntr][str(cntr) + '-' + field] = field
test_response[cntr][field] = field
else:
test_response[cntr][str(cntr) + '-' + field] = help_text
test_response[cntr][field] = help_text
else:
test_response[cntr]['fields'] = field

Expand Down

0 comments on commit ea92f8a

Please sign in to comment.