Commits

Michael Manfre committed 269edd8

Add tests to show adodbapi failure to convert SafeString and SafeUnicode objects.

Comments (1)

Files changed (2)

tests/test_main/regressiontests/models.py

     Simple table consisting of only an Integer ID primary key
     """
     id = models.IntegerField(primary_key=True)
+
+class StringTable(models.Model):
+    name = models.CharField(max_length=50)

tests/test_main/regressiontests/tests.py

 from django.core.exceptions import ImproperlyConfigured
 from django.db import models, connection
 from django.test import TestCase
+from django.utils.safestring import mark_safe
 
-from regressiontests.models import Bug69Table1, Bug69Table2, Bug70Table, Bug93Table, IntegerIdTable
+from regressiontests.models import Bug69Table1, Bug69Table2, Bug70Table, Bug93Table, IntegerIdTable, StringTable
 
 class Bug38Table(models.Model):
     d = models.DecimalField(max_digits=5, decimal_places=2)
 
         for val, expected in pairs:
             self.assertEqual(expected, _re_data_type_terminator.split(val)[0])
+
+class SafeStringTestCase(TestCase):
+    def test_ascii(self):
+        obj = StringTable(name=mark_safe('string'))
+        obj.save()
+        self.assertEqual(str(obj.name), str(StringTable.objects.get(pk=obj.id).name))
+
+    def test_unicode(self):
+        obj = StringTable(name=mark_safe(u'string'))
+        obj.save()
+        self.assertEqual(unicode(obj.name), unicode(StringTable.objects.get(pk=obj.id).name))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.