from unittest import IsolatedAsyncioTestCase
from django.test import TestCase
from contextlib import aclosing
from . import views


class Test(IsolatedAsyncioTestCase, TestCase):
    async def test_cleanup(self) -> None:
        response = self.client.get("/")
        async with aclosing(response.streaming_content) as chunks:
            async for _ in chunks:
                break
        self.assertTrue(views.cleaned_up)
