Пример #1
0
    def test_character_set_not_utf8_compatible(self):
        with connection.cursor() as cursor:
            cursor.execute("SELECT @@character_set_client")
            orig_charset = cursor.fetchone()[0]
            cursor.execute("SET NAMES 'latin1'")
            try:
                errors = DynamicModel.check()
            finally:
                cursor.execute(f"SET NAMES '{orig_charset}'")

        assert len(errors) == 1
        assert errors[0].id == "django_mysql.E014"
        assert "The MySQL charset must be 'utf8'" in errors[0].msg
Пример #2
0
 def test_mariadb_dyncol_missing(self):
     errors = DynamicModel.check()
     assert len(errors) == 1
     assert errors[0].id == "django_mysql.E012"
     assert "'mariadb_dyncol' is required" in errors[0].msg