Ticket #19020: 19020-patch1.diff

File 19020-patch1.diff, 2.3 KB (added by Matt McDonald, 12 years ago)
  • django/contrib/formtools/tests/__init__.py

    diff --git a/django/contrib/formtools/tests/__init__.py b/django/contrib/formtools/tests/__init__.py
    index 1594133..6f7b6fe 100644
    a b class DummyRequest(http.HttpRequest):  
    218218)
    219219class WizardTests(TestCase):
    220220    urls = 'django.contrib.formtools.tests.urls'
    221     input_re = re.compile('name="([^"]+)" value="([^"]+)"')
     221    name_re = re.compile('name="([^"]+)"')
     222    value_re = re.compile('value="([^"]+)"')
    222223    wizard_step_data = (
    223224        {
    224225            '0-name': 'Pony',
    class WizardTests(TestCase):  
    410411        Pull the appropriate field data from the context to pass to the next wizard step
    411412        """
    412413        previous_fields = response.context['previous_fields']
    413         fields = {'wizard_step': response.context['step0']}
    414 
    415         def grab(m):
    416             fields[m.group(1)] = m.group(2)
    417             return ''
    418 
    419         self.input_re.sub(grab, previous_fields)
     414        fields = dict(zip(
     415            self.name_re.findall(previous_fields),
     416            self.value_re.findall(previous_fields)))
     417        fields['wizard_step'] = response.context['step0']
    420418        return fields
    421419
    422420    def check_wizard_step(self, response, step_no):
  • django/contrib/formtools/tests/wizard/cookiestorage.py

    diff --git a/django/contrib/formtools/tests/wizard/cookiestorage.py b/django/contrib/formtools/tests/wizard/cookiestorage.py
    index 495d3af..f0be2b8 100644
    a b from django.test import TestCase  
    22from django.core import signing
    33from django.core.exceptions import SuspiciousOperation
    44from django.http import HttpResponse
     5from django.utils import simplejson as json
    56
    67from django.contrib.formtools.wizard.storage.cookie import CookieStorage
    78from django.contrib.formtools.tests.wizard.storage import get_request, TestStorage
    class TestCookieStorage(TestStorage, TestCase):  
    4142        storage.init_data()
    4243        storage.update_response(response)
    4344        unsigned_cookie_data = cookie_signer.unsign(response.cookies[storage.prefix].value)
    44         self.assertEqual(unsigned_cookie_data, '{"step_files":{},"step":null,"extra_data":{},"step_data":{}}')
     45        self.assertEqual(json.loads(unsigned_cookie_data), {"step_files":{},"step":None,"extra_data":{},"step_data":{}})
Back to Top