@@ -0,0 +1,1609 @@
+import datetime%0Afrom django.test import TestCase%0A%0Afrom corehq.apps.registration.models import AsyncSignupRequest%0Afrom corehq.apps.registration.tasks import delete_old_async_signup_requests%0A%0A%0Aclass TestDeleteAsyncSignupRequestsTask(TestCase):%0A%0A    def tearDown(self):%0A        super().tearDown()%0A        AsyncSignupRequest.objects.all().delete()%0A%0A    def test_request_greater_than_one_day_is_deleted(self):%0A        %22%22%22%0A        Ensure that AsyncSignupRequests older than one day are all deleted.%0A        %22%22%22%0A        yesterday = datetime.datetime.utcnow() - datetime.timedelta(days=1, minutes=2)%0A%0A        first_request = AsyncSignupRequest.objects.create(username=%22firstuser@gmail.com%22)%0A        first_request.date_created = yesterday  # done here because of auto_now_add%0A        first_request.save()%0A%0A        second_request = AsyncSignupRequest.objects.create(username=%22seconduser@gmail.com%22)%0A        second_request.date_created = yesterday%0A        second_request.save()%0A%0A        self.assertEqual(AsyncSignupRequest.objects.count(), 2)%0A        delete_old_async_signup_requests()%0A        self.assertEqual(AsyncSignupRequest.objects.count(), 0)%0A%0A    def test_request_less_than_one_day_are_kept(self):%0A        %22%22%22%0A        Ensure that AsyncSignupRequests less than 1 day old are not deleted.%0A        %22%22%22%0A        AsyncSignupRequest.objects.create(username=%22today1@gmail.com%22)%0A        AsyncSignupRequest.objects.create(username=%22today2@gmail.com%22)%0A        self.assertEqual(AsyncSignupRequest.objects.count(), 2)%0A        delete_old_async_signup_requests()%0A        self.assertEqual(AsyncSignupRequest.objects.count(), 2)%0A

add tests for the cleanup task for AsyncSignupRequest