test(supabase): deactivated-account upload check uses a fresh quarantine key (the real stack forbids direct storage deletes)

This commit is contained in:
bchanot committed 2026-10-13 19:59:39 +02:00
1 parent c386a08b0b
commit 369478576e
1 file changed
+4 -2
+4 -2
View File
@@ -535,8 +535,10 @@ select set_config('request.jwt.claims', '{"sub":"40000000-0000-0000-0000-0000000
select throws_ok($$ select public.confirm_asset_upload(gen_random_uuid()) $$, '42501', null, 'a deactivated account cannot confirm an upload');
select throws_ok($$ select public.begin_avatar_upload('image/jpeg', 1000) $$, '42501', null, 'a deactivated account cannot begin an upload');
reset role;
update public.assets set status = 'pending_upload', locked_at = null, lock_token = null, attempts = 0 where id = pg_temp.id('c1');
delete from storage.objects where name = (pg_temp.row('c1')).quarantine_key;
-- Back to pending under a fresh quarantine key (the real stack forbids deleting storage rows directly).
update public.assets set status = 'pending_upload', locked_at = null, lock_token = null, attempts = 0,
quarantine_key = 'quarantine/40000000-0000-0000-0000-00000000000c/' || gen_random_uuid() || '/upload'
where id = pg_temp.id('c1');
set local role authenticated;
select set_config('request.jwt.claims', '{"sub":"40000000-0000-0000-0000-00000000000c","role":"authenticated"}', true);
select throws_ok(