summaryrefslogtreecommitdiff
path: root/tests/regressiontests/inspectdb/tests.py
blob: a81a97df5eb1d0aab6942ca021dad05620419f46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from StringIO import StringIO

from django.core.management import call_command
from django.test import TestCase


class InspectDBTestCase(TestCase):
    def test_attribute_name_not_python_keyword(self):
        out = StringIO()
        call_command('inspectdb', stdout=out)
        error_message = "inspectdb generated an attribute name which is a python keyword"
        self.assertFalse("from = models.ForeignKey(InspectdbPeople)" in out.getvalue(), msg=error_message)
        self.assertTrue("from_field = models.ForeignKey(InspectdbPeople)" in out.getvalue())
        out.close()