aboutsummaryrefslogtreecommitdiff
path: root/xcode/OLMKitTests/OLMKitGroupTests.m
diff options
context:
space:
mode:
authormanuroe <manu@matrix.org>2016-11-14 16:54:51 +0100
committermanuroe <manu@matrix.org>2016-11-14 16:54:51 +0100
commitcf66af6f2e7c69a3e0712317f8473ab09711d426 (patch)
tree425ad41ff31014973628daa8054772939e53edcd /xcode/OLMKitTests/OLMKitGroupTests.m
parent27a8c28da4e5c62d8863ee3d30642109d713c4d6 (diff)
OLMKit: Replaced NSAsserts by NSErrors
Diffstat (limited to 'xcode/OLMKitTests/OLMKitGroupTests.m')
-rw-r--r--xcode/OLMKitTests/OLMKitGroupTests.m14
1 files changed, 10 insertions, 4 deletions
diff --git a/xcode/OLMKitTests/OLMKitGroupTests.m b/xcode/OLMKitTests/OLMKitGroupTests.m
index cdfb704..43e2df8 100644
--- a/xcode/OLMKitTests/OLMKitGroupTests.m
+++ b/xcode/OLMKitTests/OLMKitGroupTests.m
@@ -37,6 +37,7 @@
}
- (void)testAliceAndBob {
+ NSError *error;
OLMOutboundGroupSession *aliceSession = [[OLMOutboundGroupSession alloc] initOutboundGroupSession];
XCTAssertGreaterThan(aliceSession.sessionIdentifier.length, 0);
@@ -47,18 +48,23 @@
NSString *sessionKey = aliceSession.sessionKey;
NSString *message = @"Hello!";
- NSString *aliceToBobMsg = [aliceSession encryptMessage:message];
+ NSString *aliceToBobMsg = [aliceSession encryptMessage:message error:&error];
XCTAssertEqual(aliceSession.messageIndex, 1);
XCTAssertGreaterThanOrEqual(aliceToBobMsg.length, 0);
+ XCTAssertNil(error);
- OLMInboundGroupSession *bobSession = [[OLMInboundGroupSession alloc] initInboundGroupSessionWithSessionKey:sessionKey];
+ OLMInboundGroupSession *bobSession = [[OLMInboundGroupSession alloc] initInboundGroupSessionWithSessionKey:sessionKey error:&error];
XCTAssertEqualObjects(aliceSession.sessionIdentifier, bobSession.sessionIdentifier);
+ XCTAssertNil(error);
NSUInteger messageIndex;
- NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg messageIndex:&messageIndex];
+
+ NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg messageIndex:&messageIndex error:&error];
XCTAssertEqualObjects(message, plaintext);
+
XCTAssertEqual(messageIndex, 0);
+ XCTAssertNil(error);
}
- (void)testOutboundGroupSessionSerialization {
@@ -76,7 +82,7 @@
OLMOutboundGroupSession *aliceSession = [[OLMOutboundGroupSession alloc] initOutboundGroupSession];
- OLMInboundGroupSession *bobSession = [[OLMInboundGroupSession alloc] initInboundGroupSessionWithSessionKey:aliceSession.sessionKey];
+ OLMInboundGroupSession *bobSession = [[OLMInboundGroupSession alloc] initInboundGroupSessionWithSessionKey:aliceSession.sessionKey error:nil];
NSData *bobData = [NSKeyedArchiver archivedDataWithRootObject:bobSession];
OLMInboundGroupSession *bobSession2 = [NSKeyedUnarchiver unarchiveObjectWithData:bobData];