# Path: django_cassandra_engine/utils.py
# def get_cassandra_connections():
#     """
#     :return: List of tuples (db_alias, connection) for all cassandra
#     connections in DATABASES dict.
#     """
#     from django.db import connections
# 
#     for alias in connections:
#         engine = connections[alias].settings_dict.get("ENGINE", "")
#         if engine == "django_cassandra_engine":
#             yield alias, connections[alias]
# 
# def get_cassandra_db_aliases():
#     from django.db import connections
# 
#     for alias in connections:
#         engine = connections[alias].settings_dict.get("ENGINE", "")
#         if engine == "django_cassandra_engine":
#             yield alias


from django.core.management import call_command
from django.test import TestCase as DjangoTestCase
from django_cassandra_engine.utils import (
    get_cassandra_connections,
    get_cassandra_db_aliases,
)



class TestCase(DjangoTestCase):
    databases = list(get_cassandra_db_aliases())

    def _should_reload_connections(self):
        return False

    def _fixture_teardown(self):
        """
        Allow normal django TestCase fixture teardown, but also flush the test
        database for each cassandra alias.
        """
        super(TestCase, self)._fixture_teardown()


# Path: django_cassandra_engine/utils.py
# def get_cassandra_connections():
#     """
#     :return: List of tuples (db_alias, connection) for all cassandra
#     connections in DATABASES dict.
#     """
#     from django.db import connections
# 
#     for alias in connections:
#         engine = connections[alias].settings_dict.get("ENGINE", "")
#         if engine == "django_cassandra_engine":
#             yield alias, connections[alias]
# 
# def get_cassandra_db_aliases():
#     from django.db import connections
# 
#     for alias in connections:
#         engine = connections[alias].settings_dict.get("ENGINE", "")
#         if engine == "django_cassandra_engine":
#             yield alias


# Path: django_cassandra_engine/test.py
from django.core.management import call_command
from django.test import TestCase as DjangoTestCase
from django_cassandra_engine.utils import (
    get_cassandra_connections,
    get_cassandra_db_aliases,
)




class TestCase(DjangoTestCase):
    databases = list(get_cassandra_db_aliases())

    def _should_reload_connections(self):
        return False

    def _fixture_teardown(self):
        """
        Allow normal django TestCase fixture teardown, but also flush the test
        database for each cassandra alias.
        """
        super(TestCase, self)._fixture_teardown()


        for alias, _ in get_cassandra_connections():