# Path: src/publisher/tests/base.py
# class BaseCase(SimpleBaseCase, DjangoTestCase):
#     pass


import re
from explorer import models
from django.core.management import call_command
from .base import BaseCase
from io import StringIO


class CLI(BaseCase):
    def setUp(self):
        self.nom = "query_export"
        q = models.Query(
            **{"title": "dummy-query", "sql": "select count(*) from publisher_article;"}
        )
        q.save()
        self.q = models.Query.objects.first()

    def call_command(self, *args, **kwargs):
        stdout = StringIO()
        try:

# Path: src/publisher/tests/base.py
# class BaseCase(SimpleBaseCase, DjangoTestCase):
#     pass


# Path: src/publisher/tests/test_query_export.py
import re
from explorer import models
from django.core.management import call_command
from .base import BaseCase
from io import StringIO



class CLI(BaseCase):
    def setUp(self):
        self.nom = "query_export"
        q = models.Query(
            **{"title": "dummy-query", "sql": "select count(*) from publisher_article;"}
        )
        q.save()
        self.q = models.Query.objects.first()

    def call_command(self, *args, **kwargs):
        stdout = StringIO()
        try:

            kwargs["stdout"] = stdout