# Path: django_sharding_library/constants.py
# class Backends(object):
#     MYSQL = ('django.db.backends.mysql', 'django.contrib.gis.db.backends.mysql')
#     POSTGRES = ('django.db.backends.postgresql_psycopg2', 'django.db.backends.postgresql', 'django.contrib.gis.db.backends.postgis')
#     SQLITE = ('django.db.backends.sqlite3', 'django.contrib.gis.db.backends.spacialite')


import os
from django.conf import settings
from django.test import TransactionTestCase
from django_sharding_library.constants import Backends




class TravisTestCase(TransactionTestCase):
    databases = '__all__'

    def test_travis_uses_non_sqlite_databases(self):
        TRAVISCI = os.environ.get('TRAVIS')

        self.assertEqual(len(settings.DATABASES), 7)

        if TRAVISCI:
            self.assertIn(settings.DATABASES['default']['ENGINE'], Backends.POSTGRES)
            self.assertIn(settings.DATABASES['app_shard_001']['ENGINE'], Backends.MYSQL)
            self.assertIn(settings.DATABASES['app_shard_001_replica_001']['ENGINE'], Backends.POSTGRES)
            self.assertIn(settings.DATABASES['app_shard_001_replica_002']['ENGINE'], Backends.POSTGRES)
            self.assertIn(settings.DATABASES['app_shard_002']['ENGINE'], Backends.POSTGRES)

# Path: django_sharding_library/constants.py
# class Backends(object):
#     MYSQL = ('django.db.backends.mysql', 'django.contrib.gis.db.backends.mysql')
#     POSTGRES = ('django.db.backends.postgresql_psycopg2', 'django.db.backends.postgresql', 'django.contrib.gis.db.backends.postgis')
#     SQLITE = ('django.db.backends.sqlite3', 'django.contrib.gis.db.backends.spacialite')


# Path: tests/test_travis.py
import os
from django.conf import settings
from django.test import TransactionTestCase
from django_sharding_library.constants import Backends





class TravisTestCase(TransactionTestCase):
    databases = '__all__'

    def test_travis_uses_non_sqlite_databases(self):
        TRAVISCI = os.environ.get('TRAVIS')

        self.assertEqual(len(settings.DATABASES), 7)

        if TRAVISCI:
            self.assertIn(settings.DATABASES['default']['ENGINE'], Backends.POSTGRES)
            self.assertIn(settings.DATABASES['app_shard_001']['ENGINE'], Backends.MYSQL)
            self.assertIn(settings.DATABASES['app_shard_001_replica_001']['ENGINE'], Backends.POSTGRES)
            self.assertIn(settings.DATABASES['app_shard_001_replica_002']['ENGINE'], Backends.POSTGRES)
            self.assertIn(settings.DATABASES['app_shard_002']['ENGINE'], Backends.POSTGRES)

            self.assertIn(settings.DATABASES['app_shard_003']['ENGINE'], Backends.POSTGRES)