ExceptionWrap loadPreKey

pull/1/head
Michael Kirk 7 years ago
parent b622b3a020
commit 5f5ec9b82a

@ -49,7 +49,7 @@
} }
} }
- (PreKeyRecord *)loadPreKey:(int)preKeyId - (PreKeyRecord *)try_loadPreKey:(int)preKeyId
{ {
PreKeyRecord *preKeyRecord = [self.dbReadConnection preKeyRecordForKey:[self keyFromInt:preKeyId] PreKeyRecord *preKeyRecord = [self.dbReadConnection preKeyRecordForKey:[self keyFromInt:preKeyId]
inCollection:OWSPrimaryStoragePreKeyStoreCollection]; inCollection:OWSPrimaryStoragePreKeyStoreCollection];

@ -36,7 +36,7 @@ NSString *const OWSPrimaryStorageKeyPrekeyCurrentSignedPrekeyId = @"currentSigne
generatedAt:[NSDate date]]; generatedAt:[NSDate date]];
} }
- (SignedPreKeyRecord *)loadSignedPrekey:(int)signedPreKeyId - (SignedPreKeyRecord *)try_loadSignedPrekey:(int)signedPreKeyId
{ {
SignedPreKeyRecord *preKeyRecord = SignedPreKeyRecord *preKeyRecord =
[self.dbReadConnection signedPreKeyRecordForKey:[self keyFromInt:signedPreKeyId] [self.dbReadConnection signedPreKeyRecordForKey:[self keyFromInt:signedPreKeyId]

@ -35,10 +35,10 @@
PreKeyRecord *lastPreKeyRecord = [generatedKeys lastObject]; PreKeyRecord *lastPreKeyRecord = [generatedKeys lastObject];
PreKeyRecord *firstPreKeyRecord = [generatedKeys firstObject]; PreKeyRecord *firstPreKeyRecord = [generatedKeys firstObject];
XCTAssert([[[OWSPrimaryStorage sharedManager] loadPreKey:lastPreKeyRecord.Id].keyPair.publicKey XCTAssert([[[OWSPrimaryStorage sharedManager] try_loadPreKey:lastPreKeyRecord.Id].keyPair.publicKey
isEqualToData:lastPreKeyRecord.keyPair.publicKey]); isEqualToData:lastPreKeyRecord.keyPair.publicKey]);
XCTAssert([[[OWSPrimaryStorage sharedManager] loadPreKey:firstPreKeyRecord.Id].keyPair.publicKey XCTAssert([[[OWSPrimaryStorage sharedManager] try_loadPreKey:firstPreKeyRecord.Id].keyPair.publicKey
isEqualToData:firstPreKeyRecord.keyPair.publicKey]); isEqualToData:firstPreKeyRecord.keyPair.publicKey]);
} }
@ -56,8 +56,8 @@
[[OWSPrimaryStorage sharedManager] removePreKey:lastPreKeyRecord.Id]; [[OWSPrimaryStorage sharedManager] removePreKey:lastPreKeyRecord.Id];
XCTAssertThrows([[OWSPrimaryStorage sharedManager] loadPreKey:lastPreKeyRecord.Id]); XCTAssertThrows([[OWSPrimaryStorage sharedManager] try_loadPreKey:lastPreKeyRecord.Id]);
XCTAssertNoThrow([[OWSPrimaryStorage sharedManager] loadPreKey:firstPreKeyRecord.Id]); XCTAssertNoThrow([[OWSPrimaryStorage sharedManager] try_loadPreKey:firstPreKeyRecord.Id]);
} }
@end @end

Loading…
Cancel
Save