Merge pull request #295 from WhisperSystems/mkirk/fix-tests

fix tests
pull/1/head
Michael Kirk 8 years ago committed by GitHub
commit 2216c2d413

@ -30,9 +30,10 @@
} }
- (void)testSignedPreKeyDeletion { - (void)testSignedPreKeyDeletion {
[[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { [[TSStorageManager sharedManager].dbReadWriteConnection
[transaction removeAllObjectsInCollection:TSStorageManagerSignedPreKeyStoreCollection]; readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
}]; [transaction removeAllObjectsInCollection:TSStorageManagerSignedPreKeyStoreCollection];
}];
int days = 20; int days = 20;
int lastPreKeyId = days; int lastPreKeyId = days;
@ -69,9 +70,10 @@
- (void)testSignedPreKeyDeletionKeepsSomeOldKeys - (void)testSignedPreKeyDeletionKeepsSomeOldKeys
{ {
[[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { [[TSStorageManager sharedManager].dbReadWriteConnection
[transaction removeAllObjectsInCollection:TSStorageManagerSignedPreKeyStoreCollection]; readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
}]; [transaction removeAllObjectsInCollection:TSStorageManagerSignedPreKeyStoreCollection];
}];
int lastPreKeyId = 10; int lastPreKeyId = 10;
for (int i = 0; i <= 10; i++) { for (int i = 0; i <= 10; i++) {
@ -113,10 +115,11 @@
} }
- (void)testOlderRecordsNotDeletedIfNoReplacement { - (void)testOlderRecordsNotDeletedIfNoReplacement {
[[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { [[TSStorageManager sharedManager].dbReadWriteConnection
[transaction removeAllObjectsInCollection:TSStorageManagerSignedPreKeyStoreCollection]; readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
}]; [transaction removeAllObjectsInCollection:TSStorageManagerSignedPreKeyStoreCollection];
}];
int days = 3; int days = 3;
int lastPreKeyId = days; int lastPreKeyId = days;

@ -27,13 +27,14 @@
- (void)setUp - (void)setUp
{ {
[super setUp]; [super setUp];
[[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { [[TSStorageManager sharedManager].dbReadWriteConnection
self.thread = [TSContactThread getOrCreateThreadWithContactId:@"aStupidId" transaction:transaction]; readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
self.thread = [TSContactThread getOrCreateThreadWithContactId:@"aStupidId" transaction:transaction];
[self.thread saveWithTransaction:transaction];
}]; [self.thread saveWithTransaction:transaction];
}];
TSStorageManager *manager = [TSStorageManager sharedManager]; TSStorageManager *manager = [TSStorageManager sharedManager];
[manager purgeCollection:[TSMessage collection]]; [manager purgeCollection:[TSMessage collection]];
} }
@ -154,7 +155,8 @@
NSString *body = @"A child born today will grow up with no conception of privacy at all. Theyll never know what it means to have a private moment to themselves an unrecorded, unanalyzed thought. And thats a problem because privacy matters; privacy is what allows us to determine who we are and who we want to be."; NSString *body = @"A child born today will grow up with no conception of privacy at all. Theyll never know what it means to have a private moment to themselves an unrecorded, unanalyzed thought. And thats a problem because privacy matters; privacy is what allows us to determine who we are and who we want to be.";
__block TSGroupThread *thread; __block TSGroupThread *thread;
[[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { [[TSStorageManager sharedManager].dbReadWriteConnection readWriteWithBlock:^(
YapDatabaseReadWriteTransaction *transaction) {
thread = [TSGroupThread getOrCreateThreadWithGroupModel:[[TSGroupModel alloc] initWithTitle:@"fdsfsd" thread = [TSGroupThread getOrCreateThreadWithGroupModel:[[TSGroupModel alloc] initWithTitle:@"fdsfsd"
memberIds:[@[] mutableCopy] memberIds:[@[] mutableCopy]
image:nil image:nil

Loading…
Cancel
Save