diff --git a/lib/tasks/tests.rake b/lib/tasks/tests.rake index 209a73efa5e844..49376075ffc022 100644 --- a/lib/tasks/tests.rake +++ b/lib/tasks/tests.rake @@ -83,6 +83,21 @@ namespace :tests do puts 'Default posting language not migrated as expected for kmr users' exit(1) end + + unless Account.find_by(username: 'suspended', domain: nil).suspended? + puts 'Unexpected value for Account#suspended? for user @suspended' + exit(1) + end + + if Account.find_by(username: 'deleted', domain: nil).suspended? + puts 'Unexpected value for Account#suspended? for user @deleted' + exit(1) + end + + unless Account.find_by(username: 'deleted', domain: nil).deleted? + puts 'Unexpected value for Account#deleted? for user @deleted' + exit(1) + end end desc 'Populate the database with test data for 2.4.3' @@ -142,12 +157,12 @@ namespace :tests do INSERT INTO "accounts" (id, username, domain, private_key, public_key, created_at, updated_at) VALUES - (10, 'kmruser', NULL, #{user_private_key}, #{user_public_key}, now(), now()); + (12, 'kmruser', NULL, #{user_private_key}, #{user_public_key}, now(), now()); INSERT INTO "users" (id, account_id, email, created_at, updated_at, admin, locale, chosen_languages) VALUES - (4, 10, 'kmruser@localhost', now(), now(), false, 'ku', '{en,kmr,ku,ckb}'); + (5, 12, 'kmruser@localhost', now(), now(), false, 'ku', '{en,kmr,ku,ckb}'); INSERT INTO "settings" (id, thing_type, thing_id, var, value, created_at, updated_at) @@ -221,18 +236,25 @@ namespace :tests do 1, 'https://activitypub.com/users/evil/inbox', 'https://activitypub.com/users/evil/outbox', 'https://activitypub.com/users/evil/followers', true); + INSERT INTO "accounts" + (id, username, domain, private_key, public_key, created_at, updated_at, suspended) + VALUES + (10, 'suspended', NULL, #{admin_private_key}, #{admin_public_key}, now(), now(), true), + (11, 'deleted', NULL, #{user_private_key}, #{user_public_key}, now(), now(), true); + -- users INSERT INTO "users" (id, account_id, email, created_at, updated_at, admin) VALUES (1, 1, 'admin@localhost', now(), now(), true), - (2, 2, 'user@localhost', now(), now(), false); + (2, 2, 'user@localhost', now(), now(), false), + (3, 10, 'suspended@localhost', now(), now(), false); INSERT INTO "users" (id, account_id, email, created_at, updated_at, admin, locale) VALUES - (3, 8, 'ptuser@localhost', now(), now(), false, 'pt'); + (4, 8, 'ptuser@localhost', now(), now(), false, 'pt'); -- conversations INSERT INTO "conversations" (id, created_at, updated_at) VALUES (1, now(), now());