From 9a2270e3dbcf15231f05aa6fb58202825ea42ac4 Mon Sep 17 00:00:00 2001 From: SimpleTest Date: Thu, 13 Aug 2026 05:41:47 +0300 Subject: [PATCH] Cover verified case cleanup boundaries --- .../workers/expire_requests_test.exs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/who_need_help/workers/expire_requests_test.exs b/test/who_need_help/workers/expire_requests_test.exs index 370dcde..b4d6f29 100644 --- a/test/who_need_help/workers/expire_requests_test.exs +++ b/test/who_need_help/workers/expire_requests_test.exs @@ -137,6 +137,29 @@ defmodule WhoNeedHelp.Workers.ExpireRequestsTest do removal_attrs.("fresh-removal@example.com", "fresh") ) + assert {:ok, verified_removal} = + ContentRemoval.create_notice( + nil, + :general, + removal_attrs.("verified-removal@example.com", "verified") + ) + + assert {:ok, verified_removal} = + ContentRemoval.verify_by_confirmation_token( + verified_removal.id, + ContentRemoval.confirmation_token(verified_removal) + ) + + assert {:ok, no_contact_urgent_removal} = + ContentRemoval.create_notice(nil, :general, %{ + "category" => "child_sexual_abuse_material", + "content_locations" => "https://example.test/requests/no-contact-urgent", + "explanation" => + "This permitted no-contact report exercises urgent queue retention.", + "good_faith" => "true", + "accurate_complete" => "true" + }) + max_age = Application.fetch_env!(:who_need_help, :public_contact_verification_max_age_seconds) @@ -152,6 +175,13 @@ defmodule WhoNeedHelp.Workers.ExpireRequestsTest do set: [inserted_at: expired_at] ) + Repo.update_all( + from(notice in Notice, + where: notice.id in ^[verified_removal.id, no_contact_urgent_removal.id] + ), + set: [inserted_at: expired_at] + ) + assert {:ok, %{ unverified_support_pruned: 1, @@ -163,6 +193,8 @@ defmodule WhoNeedHelp.Workers.ExpireRequestsTest do assert Repo.get(SupportRequest, fresh_support.id) assert Repo.get(SupportRequest, verified_support.id) assert Repo.get(Notice, fresh_removal.id) + assert Repo.get(Notice, verified_removal.id) + assert Repo.get(Notice, no_contact_urgent_removal.id) refute Repo.exists?( from(event in AuditEvent,