Ticket #12163: 12163_test.diff

File 12163_test.diff, 983 bytes (added by Ryan Fugger, 14 years ago)

Test case added to defer_regress tests.

  • tests/regressiontests/defer_regress/models.py

     
    115115>>> results[0].second_child.name
    116116u'c2'
    117117
     118# Test for #12163 - Pickling error saving session with unsaved model instances.
     119>>> from django.contrib.sessions.backends.db import SessionStore
     120>>> SESSION_KEY = '2b1189a188b44ad18c35e1baac6ceead'
     121>>> item = Item()
     122>>> s = SessionStore(SESSION_KEY)
     123>>> s.clear()
     124>>> s['item'] = item
     125>>> s.save()
     126>>> s = SessionStore(SESSION_KEY)  # Reloads item as Item_Deferred_ instance.
     127>>> s.modified = True
     128>>> s.save()  # Must be able to pickle Item_Deferred_.
     129
    118130# Finally, we need to flush the app cache for the defer module.
    119131# Using only/defer creates some artifical entries in the app cache
    120132# that messes up later tests. Purge all entries, just to be sure.
Back to Top