Cover verified case cleanup boundaries
This commit is contained in:
parent
7130be3b69
commit
9a2270e3db
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user