diff --git a/tests/Account/SignedPreKeyDeletionTests.m b/tests/Account/SignedPreKeyDeletionTests.m index d5c6cd7ed..c1e9c0e1c 100644 --- a/tests/Account/SignedPreKeyDeletionTests.m +++ b/tests/Account/SignedPreKeyDeletionTests.m @@ -30,9 +30,10 @@ } - (void)testSignedPreKeyDeletion { - [[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - [transaction removeAllObjectsInCollection:TSStorageManagerSignedPreKeyStoreCollection]; - }]; + [[TSStorageManager sharedManager].dbReadWriteConnection + readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { + [transaction removeAllObjectsInCollection:TSStorageManagerSignedPreKeyStoreCollection]; + }]; int days = 20; int lastPreKeyId = days; @@ -69,9 +70,10 @@ - (void)testSignedPreKeyDeletionKeepsSomeOldKeys { - [[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - [transaction removeAllObjectsInCollection:TSStorageManagerSignedPreKeyStoreCollection]; - }]; + [[TSStorageManager sharedManager].dbReadWriteConnection + readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { + [transaction removeAllObjectsInCollection:TSStorageManagerSignedPreKeyStoreCollection]; + }]; int lastPreKeyId = 10; for (int i = 0; i <= 10; i++) { @@ -113,10 +115,11 @@ } - (void)testOlderRecordsNotDeletedIfNoReplacement { - [[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - [transaction removeAllObjectsInCollection:TSStorageManagerSignedPreKeyStoreCollection]; - }]; - + [[TSStorageManager sharedManager].dbReadWriteConnection + readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { + [transaction removeAllObjectsInCollection:TSStorageManagerSignedPreKeyStoreCollection]; + }]; + int days = 3; int lastPreKeyId = days; diff --git a/tests/Storage/TSMessageStorageTests.m b/tests/Storage/TSMessageStorageTests.m index ac35145e3..64b351dba 100644 --- a/tests/Storage/TSMessageStorageTests.m +++ b/tests/Storage/TSMessageStorageTests.m @@ -27,13 +27,14 @@ - (void)setUp { [super setUp]; - - [[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - self.thread = [TSContactThread getOrCreateThreadWithContactId:@"aStupidId" transaction:transaction]; - - [self.thread saveWithTransaction:transaction]; - }]; - + + [[TSStorageManager sharedManager].dbReadWriteConnection + readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { + self.thread = [TSContactThread getOrCreateThreadWithContactId:@"aStupidId" transaction:transaction]; + + [self.thread saveWithTransaction:transaction]; + }]; + TSStorageManager *manager = [TSStorageManager sharedManager]; [manager purgeCollection:[TSMessage collection]]; } @@ -154,7 +155,8 @@ NSString *body = @"A child born today will grow up with no conception of privacy at all. They’ll never know what it means to have a private moment to themselves an unrecorded, unanalyzed thought. And that’s a problem because privacy matters; privacy is what allows us to determine who we are and who we want to be."; __block TSGroupThread *thread; - [[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { + [[TSStorageManager sharedManager].dbReadWriteConnection readWriteWithBlock:^( + YapDatabaseReadWriteTransaction *transaction) { thread = [TSGroupThread getOrCreateThreadWithGroupModel:[[TSGroupModel alloc] initWithTitle:@"fdsfsd" memberIds:[@[] mutableCopy] image:nil