PageRenderTime 223ms CodeModel.GetById 121ms app.highlight 2ms RepoModel.GetById 99ms app.codeStats 0ms

/tests/regressiontests/inspectdb/tests.py

https://code.google.com/p/mango-py/
Python | 16 lines | 12 code | 4 blank | 0 comment | 0 complexity | b9d27b72bfe301f7e65b3fafc026186c MD5 | raw file
 1from StringIO import StringIO
 2
 3from django.core.management import call_command
 4from django.test import TestCase, skipUnlessDBFeature
 5
 6
 7class InspectDBTestCase(TestCase):
 8
 9    @skipUnlessDBFeature('can_introspect_foreign_keys')
10    def test_attribute_name_not_python_keyword(self):
11        out = StringIO()
12        call_command('inspectdb', stdout=out)
13        error_message = "inspectdb generated an attribute name which is a python keyword"
14        self.assertNotIn("from = models.ForeignKey(InspectdbPeople)", out.getvalue(), msg=error_message)
15        self.assertIn("from_field = models.ForeignKey(InspectdbPeople)", out.getvalue())
16        out.close()