PageRenderTime 50ms CodeModel.GetById 18ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause
  1. from StringIO import StringIO
  2. from django.core.management import call_command
  3. from django.test import TestCase, skipUnlessDBFeature
  4. class InspectDBTestCase(TestCase):
  5. @skipUnlessDBFeature('can_introspect_foreign_keys')
  6. def test_attribute_name_not_python_keyword(self):
  7. out = StringIO()
  8. call_command('inspectdb', stdout=out)
  9. error_message = "inspectdb generated an attribute name which is a python keyword"
  10. self.assertNotIn("from = models.ForeignKey(InspectdbPeople)", out.getvalue(), msg=error_message)
  11. self.assertIn("from_field = models.ForeignKey(InspectdbPeople)", out.getvalue())
  12. out.close()