Skip to content

Commit 0b5abf5

Browse files
committed
Add migration tests
1 parent 4e3d0f4 commit 0b5abf5

1 file changed

Lines changed: 29 additions & 7 deletions

File tree

lib/tasks/tests.rake

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,21 @@ namespace :tests do
112112
exit(1)
113113
end
114114

115+
unless Account.find_by(username: 'suspended', domain: nil).suspended?
116+
puts 'Unexpected value for Account#suspended? for user @suspended'
117+
exit(1)
118+
end
119+
120+
if Account.find_by(username: 'deleted', domain: nil).suspended?
121+
puts 'Unexpected value for Account#suspended? for user @deleted'
122+
exit(1)
123+
end
124+
125+
unless Account.find_by(username: 'deleted', domain: nil).deleted?
126+
puts 'Unexpected value for Account#deleted? for user @deleted'
127+
exit(1)
128+
end
129+
115130
unless Identity.where(provider: 'foo', uid: 0).one?
116131
puts 'Identities not deduplicated as expected'
117132
exit(1)
@@ -261,20 +276,20 @@ namespace :tests do
261276
INSERT INTO "accounts"
262277
(id, username, domain, private_key, public_key, created_at, updated_at)
263278
VALUES
264-
(10, 'kmruser', NULL, #{user_private_key}, #{user_public_key}, now(), now()),
265-
(11, 'qcuser', NULL, #{user_private_key}, #{user_public_key}, now(), now());
279+
(12, 'kmruser', NULL, #{user_private_key}, #{user_public_key}, now(), now()),
280+
(13, 'qcuser', NULL, #{user_private_key}, #{user_public_key}, now(), now());
266281
267282
INSERT INTO "users"
268283
(id, account_id, email, created_at, updated_at, admin, locale, chosen_languages)
269284
VALUES
270-
(4, 10, 'kmruser@localhost', now(), now(), false, 'ku', '{en,kmr,ku,ckb}');
285+
(5, 12, 'kmruser@localhost', now(), now(), false, 'ku', '{en,kmr,ku,ckb}');
271286
272287
INSERT INTO "users"
273288
(id, account_id, email, created_at, updated_at, locale,
274289
encrypted_otp_secret, encrypted_otp_secret_iv, encrypted_otp_secret_salt,
275290
otp_required_for_login)
276291
VALUES
277-
(5, 11, 'qcuser@localhost', now(), now(), 'fr-QC',
292+
(6, 13, 'qcuser@localhost', now(), now(), 'fr-QC',
278293
E'Fttsy7QAa0edaDfdfSz094rRLAxc8cJweDQ4BsWH/zozcdVA8o9GLqcKhn2b\nGi/V\n',
279294
'rys3THICkr60BoWC',
280295
'_LMkAGvdg7a+sDIKjI3mR2Q==',
@@ -283,7 +298,7 @@ namespace :tests do
283298
INSERT INTO "settings"
284299
(id, thing_type, thing_id, var, value, created_at, updated_at)
285300
VALUES
286-
(5, 'User', 4, 'default_language', E'--- kmr\n', now(), now()),
301+
(5, 'User', 5, 'default_language', E'--- kmr\n', now(), now()),
287302
(6, 'User', 1, 'interactions', E'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\nmust_be_follower: false\nmust_be_following: true\nmust_be_following_dm: false\n', now(), now());
288303
289304
INSERT INTO "identities"
@@ -359,18 +374,25 @@ namespace :tests do
359374
1, 'https://activitypub.com/users/evil/inbox', 'https://activitypub.com/users/evil/outbox',
360375
'https://activitypub.com/users/evil/followers', true);
361376
377+
INSERT INTO "accounts"
378+
(id, username, domain, private_key, public_key, created_at, updated_at, suspended)
379+
VALUES
380+
(10, 'suspended', NULL, #{admin_private_key}, #{admin_public_key}, now(), now(), true),
381+
(11, 'deleted', NULL, #{user_private_key}, #{user_public_key}, now(), now(), true);
382+
362383
-- users
363384
364385
INSERT INTO "users"
365386
(id, account_id, email, created_at, updated_at, admin)
366387
VALUES
367388
(1, 1, 'admin@localhost', now(), now(), true),
368-
(2, 2, 'user@localhost', now(), now(), false);
389+
(2, 2, 'user@localhost', now(), now(), false),
390+
(3, 10, 'suspended@localhost', now(), now(), false);
369391
370392
INSERT INTO "users"
371393
(id, account_id, email, created_at, updated_at, admin, locale)
372394
VALUES
373-
(3, 8, 'ptuser@localhost', now(), now(), false, 'pt');
395+
(4, 8, 'ptuser@localhost', now(), now(), false, 'pt');
374396
375397
-- conversations
376398
INSERT INTO "conversations" (id, created_at, updated_at) VALUES (1, now(), now());

0 commit comments

Comments
 (0)