Ticket #14691: multidb_management_tests.diff

File multidb_management_tests.diff, 1.8 KB (added by marcop, 13 years ago)
  • tests/regressiontests/multiple_database/tests.py

     
    17851785        b.authors.clear()
    17861786        self._write_to_default()
    17871787        self.assertEqual(receiver._database, "other")
     1788
     1789class ManagementCommandsTest(TestCase):
     1790    multi_db = True
     1791
     1792    def test01flush(self):
     1793        from django.core.management import call_command
     1794        from django.contrib.contenttypes.models import ContentType
     1795        ContentType.objects.all().delete()
     1796        ContentType.objects.using('other').all().delete()
     1797        call_command('flush', database='other', interactive=False)
     1798        self.assertTrue(ContentType.objects.using('other').all())
     1799        call_command('flush', database='default', interactive=False)
     1800        self.assertTrue(ContentType.objects.using('default').all())
     1801
     1802    def test02permissions(self):
     1803        from django.core.management import call_command
     1804        from django.contrib.auth.models import Permission
     1805        from django.contrib.contenttypes.models import ContentType
     1806        ContentType.objects.all().delete()
     1807        ContentType.objects.using('other').all().delete()
     1808        call_command('flush', database='other', interactive=False)
     1809        self.assertTrue(Permission.objects.using('other').all())
     1810
     1811    def test03createsuperuser(self):
     1812        from django.core.management import call_command
     1813        from django.contrib.auth.models import User
     1814        call_command('createsuperuser', database='other',
     1815                     username='admin', email='admin@example.com',
     1816                     interactive=False)
     1817        self.assertTrue(User.objects.using('other').all())
Back to Top