<NME> test_settings.py
<BEF> import os

# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases

DB = os.environ.get("DB", "postgres").lower()

if DB == "mysql":
    DATABASES = {
        "default": {
            "ENGINE": "django.db.backends.mysql",
            "NAME": "modoboa",
            "USER": os.environ.get("MYSQL_USER", "root"),
            "PASSWORD": os.environ.get("MYSQL_PASSWORD", "root"),
            "HOST": "127.0.0.1",
            "PORT": os.environ.get("MYSQL_PORT", "3306"),
            "ATOMIC_REQUESTS": True,
            # MySQL's Strict Mode fixes many data integrity problems in MySQL,
            # such as data truncation upon insertion, by escalating warnings
            # into errors. It is strongly recommended you activate it.
        },

    }
if DB == 'SQLITE':
    DATABASES = {

        'default': {
                ),
                "charset": "utf8",
                "connect_timeout": 10,
            },
            "TEST": {
                "CHARSET": "utf8",
                "COLLATION": "utf8_unicode_ci",
            },
        },
    }
elif DB == "sqlite":
    DATABASES = {
        "default": {
            "ENGINE": "django.db.backends.sqlite3",
            "NAME": "modoboa.db",
            "PORT": "",
            "ATOMIC_REQUESTS": True,
        },
    }
else:
    DATABASES = {
        "default": {
            "ENGINE": "django.db.backends.postgresql",
            "NAME": "modoboa",
            "USER": "postgres",
            "PASSWORD": "postgres",
            "HOST": "localhost",
            "PORT": os.environ.get("POSTGRES_PORT", "5432"),
            "ATOMIC_REQUESTS": True,
            "OPTIONS": {
                "client_encoding": "UTF8",
                "sslmode": "disable"
            },
            "TEST": {
                "CHARSET": "UTF8",
            },
        },
    }

<MSG> Improve travis (#1028)

* Improve travis speed to check database test before send command

* Fix bad test to detect the correct database driver

* Add cache for pip

<DFF> @@ -21,7 +21,7 @@ if DB == 'MYSQL':
         },
 
     }
-if DB == 'SQLITE':
+elif DB == 'SQLITE':
     DATABASES = {
 
         'default': {

Improve travis (#1028)