diff --git a/MatrixSDKTests/MXRestClientTests.m b/MatrixSDKTests/MXRestClientTests.m index 5cb8e07310..255403fe16 100644 --- a/MatrixSDKTests/MXRestClientTests.m +++ b/MatrixSDKTests/MXRestClientTests.m @@ -29,9 +29,9 @@ #pragma clang diagnostic ignored "-Warc-retain-cycles" @interface MXRestClientTests : XCTestCase -{ - MatrixSDKTestsData *matrixSDKTestsData; -} + +@property (nonatomic, strong, readonly) MatrixSDKTestsData *matrixSDKTestsData; + @end @@ -41,23 +41,23 @@ - (void)setUp { [super setUp]; - matrixSDKTestsData = [[MatrixSDKTestsData alloc] init]; + _matrixSDKTestsData = [[MatrixSDKTestsData alloc] init]; } - (void)tearDown { [super tearDown]; - matrixSDKTestsData = nil; + _matrixSDKTestsData = nil; } - (void)testInit { - [matrixSDKTestsData doMXRestClientTestWithBob:self readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBob:self readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation) { XCTAssertTrue([bobRestClient.homeserver isEqualToString:kMXTestsHomeServerURL], "bobRestClient.homeserver(%@) is wrong", bobRestClient.homeserver); - XCTAssertTrue([bobRestClient.credentials.userId isEqualToString:matrixSDKTestsData.bobCredentials.userId], "bobRestClient.userId(%@) is wrong", bobRestClient.credentials.userId); - XCTAssertTrue([bobRestClient.credentials.accessToken isEqualToString:matrixSDKTestsData.bobCredentials.accessToken], "bobRestClient.accessToken(%@) is wrong", bobRestClient.credentials.accessToken); + XCTAssertTrue([bobRestClient.credentials.userId isEqualToString:self.matrixSDKTestsData.bobCredentials.userId], "bobRestClient.userId(%@) is wrong", bobRestClient.credentials.userId); + XCTAssertTrue([bobRestClient.credentials.accessToken isEqualToString:self.matrixSDKTestsData.bobCredentials.accessToken], "bobRestClient.accessToken(%@) is wrong", bobRestClient.credentials.accessToken); [expectation fulfill]; }]; @@ -66,7 +66,7 @@ - (void)testInit - (void)testClose { // This test on sendTextMessage validates sendMessage and sendEvent too - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient sendTextMessageToRoom:roomId text:@"This is text message" success:^(NSString *eventId) { @@ -101,7 +101,7 @@ - (void)testClose - (void)testSendTextMessage { // This test on sendTextMessage validates sendMessage and sendEvent too - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient sendTextMessageToRoom:roomId text:@"This is text message" success:^(NSString *eventId) { @@ -118,7 +118,7 @@ - (void)testSendTextMessage - (void)testRoomTopic { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient setRoomTopic:roomId topic:@"Topic setter and getter functions are tested here" success:^{ @@ -143,7 +143,7 @@ - (void)testRoomTopic - (void)testRoomAvatar { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { __block MXRestClient *bobRestClient2 = bobRestClient; [bobRestClient setRoomAvatar:roomId avatar:@"http://matrix.org/matrix.png" success:^{ @@ -169,7 +169,7 @@ - (void)testRoomAvatar - (void)testRoomName { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { __block MXRestClient *bobRestClient2 = bobRestClient; [bobRestClient setRoomName:roomId name:@"My room name" success:^{ @@ -195,7 +195,7 @@ - (void)testRoomName - (void)testRoomHistoryVisibility { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { __block MXRestClient *bobRestClient2 = bobRestClient; [bobRestClient setRoomHistoryVisibility:roomId historyVisibility:kMXRoomHistoryVisibilityInvited success:^{ @@ -221,7 +221,7 @@ - (void)testRoomHistoryVisibility - (void)testRoomJoinRule { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { __block MXRestClient *bobRestClient2 = bobRestClient; [bobRestClient setRoomJoinRule:roomId joinRule:kMXRoomJoinRulePublic success:^{ @@ -247,7 +247,7 @@ - (void)testRoomJoinRule - (void)testRoomGuestAccess { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { __block MXRestClient *bobRestClient2 = bobRestClient; [bobRestClient setRoomGuestAccess:roomId guestAccess:kMXRoomGuestAccessCanJoin success:^{ @@ -273,7 +273,7 @@ - (void)testRoomGuestAccess - (void)testRoomDirectoryVisibility { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { __block MXRestClient *bobRestClient2 = bobRestClient; [bobRestClient setRoomDirectoryVisibility:roomId directoryVisibility:kMXRoomDirectoryVisibilityPublic success:^{ @@ -299,7 +299,7 @@ - (void)testRoomDirectoryVisibility - (void)testRoomAddAlias { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { NSString *globallyUniqueString = [[NSProcessInfo processInfo] globallyUniqueString]; NSString *wrongAlias = [NSString stringWithFormat:@"#%@", globallyUniqueString]; @@ -357,7 +357,7 @@ - (void)testRoomAddAlias - (void)testRoomRemoveAlias { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { NSString *globallyUniqueString = [[NSProcessInfo processInfo] globallyUniqueString]; NSString *roomAlias = [NSString stringWithFormat:@"#%@%@", globallyUniqueString, bobRestClient.homeserverSuffix]; @@ -397,7 +397,7 @@ - (void)testRoomRemoveAlias - (void)testRoomCanonicalAlias { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { NSString *globallyUniqueString = [[NSProcessInfo processInfo] globallyUniqueString]; NSString *roomAlias = [NSString stringWithFormat:@"#%@%@", globallyUniqueString, bobRestClient.homeserverSuffix]; @@ -451,7 +451,7 @@ - (void)testRoomCanonicalAlias - (void)testJoinRoomWithRoomId { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient joinRoom:roomId viaServers:nil withThirdPartySigned:nil success:^(NSString *theRoomId) { @@ -467,9 +467,9 @@ - (void)testJoinRoomWithRoomId - (void)testJoinRoomWithRoomAlias { - [matrixSDKTestsData doMXRestClientTestWithBobAndThePublicRoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndThePublicRoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { - [bobRestClient joinRoom:matrixSDKTestsData.thePublicRoomAlias viaServers:nil withThirdPartySigned:nil success:^(NSString *theRoomId) { + [bobRestClient joinRoom:self.matrixSDKTestsData.thePublicRoomAlias viaServers:nil withThirdPartySigned:nil success:^(NSString *theRoomId) { XCTAssertEqualObjects(roomId, theRoomId); [expectation fulfill]; @@ -484,7 +484,7 @@ - (void)testJoinRoomWithRoomAlias - (void)testLeaveRoom { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient leaveRoom:roomId success:^{ @@ -500,12 +500,12 @@ - (void)testLeaveRoom - (void)testInviteUserToRoom { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { - [matrixSDKTestsData doMXRestClientTestWithAlice:nil readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation2) { + [self.matrixSDKTestsData doMXRestClientTestWithAlice:nil readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation2) { // Do the test - [bobRestClient inviteUser:matrixSDKTestsData.aliceCredentials.userId toRoom:roomId success:^{ + [bobRestClient inviteUser:self.matrixSDKTestsData.aliceCredentials.userId toRoom:roomId success:^{ // Check room actual members [bobRestClient membersOfRoom:roomId success:^(NSArray *roomMemberEvents) { @@ -516,14 +516,14 @@ - (void)testInviteUserToRoom { MXRoomMember *member = [[MXRoomMember alloc] initWithMXEvent:roomMemberEvent]; - if ([member.userId isEqualToString:matrixSDKTestsData.aliceCredentials.userId]) + if ([member.userId isEqualToString:self.matrixSDKTestsData.aliceCredentials.userId]) { XCTAssertEqual(member.membership, MXMembershipInvite, @"A invited user membership is invite, not %tu", member.membership); } else { // The other user is Bob - XCTAssert([member.userId isEqualToString:matrixSDKTestsData.bobCredentials.userId], @"Unexpected member: %@", member); + XCTAssert([member.userId isEqualToString:self.matrixSDKTestsData.bobCredentials.userId], @"Unexpected member: %@", member); } } @@ -545,9 +545,9 @@ - (void)testInviteUserToRoom - (void)testKickUserFromRoom { - [matrixSDKTestsData doMXRestClientTestWithBobAndAliceInARoom:self readyToTest:^(MXRestClient *bobRestClient, MXRestClient *aliceRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndAliceInARoom:self readyToTest:^(MXRestClient *bobRestClient, MXRestClient *aliceRestClient, NSString *roomId, XCTestExpectation *expectation) { - [bobRestClient kickUser:matrixSDKTestsData.aliceCredentials.userId fromRoom:roomId reason:@"No particular reason" success:^{ + [bobRestClient kickUser:self.matrixSDKTestsData.aliceCredentials.userId fromRoom:roomId reason:@"No particular reason" success:^{ // Check room actual members [bobRestClient membersOfRoom:roomId success:^(NSArray *roomMemberEvents) { @@ -558,14 +558,14 @@ - (void)testKickUserFromRoom { MXRoomMember *member = [[MXRoomMember alloc] initWithMXEvent:roomMemberEvent]; - if ([member.userId isEqualToString:matrixSDKTestsData.aliceCredentials.userId]) + if ([member.userId isEqualToString:self.matrixSDKTestsData.aliceCredentials.userId]) { XCTAssertEqual(member.membership, MXMembershipLeave, @"A kicked user membership is leave, not %tu", member.membership); } else { // The other user is Bob - XCTAssert([member.userId isEqualToString:matrixSDKTestsData.bobCredentials.userId], @"Unexpected member: %@", member); + XCTAssert([member.userId isEqualToString:self.matrixSDKTestsData.bobCredentials.userId], @"Unexpected member: %@", member); } } @@ -585,9 +585,9 @@ - (void)testKickUserFromRoom - (void)testBanUserInRoom { - [matrixSDKTestsData doMXRestClientTestWithBobAndAliceInARoom:self readyToTest:^(MXRestClient *bobRestClient, MXRestClient *aliceRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndAliceInARoom:self readyToTest:^(MXRestClient *bobRestClient, MXRestClient *aliceRestClient, NSString *roomId, XCTestExpectation *expectation) { - [bobRestClient banUser:matrixSDKTestsData.aliceCredentials.userId inRoom:roomId reason:@"No particular reason" success:^{ + [bobRestClient banUser:self.matrixSDKTestsData.aliceCredentials.userId inRoom:roomId reason:@"No particular reason" success:^{ // Check room actual members [bobRestClient membersOfRoom:roomId success:^(NSArray *roomMemberEvents) { @@ -598,14 +598,14 @@ - (void)testBanUserInRoom { MXRoomMember *member = [[MXRoomMember alloc] initWithMXEvent:roomMemberEvent]; - if ([member.userId isEqualToString:matrixSDKTestsData.aliceCredentials.userId]) + if ([member.userId isEqualToString:self.matrixSDKTestsData.aliceCredentials.userId]) { XCTAssertEqual(member.membership, MXMembershipBan, @"A banned user membership is ban, not %tu", member.membership); } else { // The other user is Bob - XCTAssert([member.userId isEqualToString:matrixSDKTestsData.bobCredentials.userId], @"Unexpected member: %@", member); + XCTAssert([member.userId isEqualToString:self.matrixSDKTestsData.bobCredentials.userId], @"Unexpected member: %@", member); } } @@ -625,7 +625,7 @@ - (void)testBanUserInRoom - (void)testCreateRoom { - [matrixSDKTestsData doMXRestClientTestWithBob:self readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBob:self readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation) { // Create a random room with no params [bobRestClient createRoom:nil visibility:nil roomAlias:nil topic:nil success:^(MXCreateRoomResponse *response) { @@ -646,13 +646,13 @@ - (void)testCreateRoom - (void)testCreateRoomWithInvite { - [matrixSDKTestsData doMXRestClientTestWithBob:self readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBob:self readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation) { - [matrixSDKTestsData doMXRestClientTestWithAlice:nil readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation2) { + [self.matrixSDKTestsData doMXRestClientTestWithAlice:nil readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation2) { // Create a random room by inviting alice MXRoomCreationParameters *parameters = [MXRoomCreationParameters new]; - parameters.inviteArray = @[matrixSDKTestsData.aliceCredentials.userId]; + parameters.inviteArray = @[self.matrixSDKTestsData.aliceCredentials.userId]; [bobRestClient createRoomWithParameters:parameters success:^(MXCreateRoomResponse *response) { XCTAssertNotNil(response); @@ -668,9 +668,9 @@ - (void)testCreateRoomWithInvite BOOL succeed; if ([roomMemberEvent1.stateKey isEqualToString:bobRestClient.credentials.userId]) { - succeed = [roomMemberEvent2.stateKey isEqualToString:matrixSDKTestsData.aliceCredentials.userId]; + succeed = [roomMemberEvent2.stateKey isEqualToString:self.matrixSDKTestsData.aliceCredentials.userId]; } - else if ([roomMemberEvent1.stateKey isEqualToString:matrixSDKTestsData.aliceCredentials.userId]) + else if ([roomMemberEvent1.stateKey isEqualToString:self.matrixSDKTestsData.aliceCredentials.userId]) { succeed = [roomMemberEvent2.stateKey isEqualToString:bobRestClient.credentials.userId]; } @@ -696,7 +696,7 @@ - (void)testCreateRoomWithInvite - (void)testMessagesWithNoParams { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoomWithMessages:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoomWithMessages:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient messagesForRoom:roomId from:nil direction:MXTimelineDirectionBackwards limit:-1 filter:nil success:^(MXPaginationResponse *paginatedResponse) { @@ -718,7 +718,7 @@ - (void)testMessagesWithNoParams - (void)testMessagesWithOneParam { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoomWithMessages:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoomWithMessages:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient messagesForRoom:roomId from:nil direction:MXTimelineDirectionBackwards limit:100 filter:nil success:^(MXPaginationResponse *paginatedResponse) { @@ -740,7 +740,7 @@ - (void)testMessagesWithOneParam - (void)testMembers { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient membersOfRoom:roomId success:^(NSArray *roomMemberEvents) { @@ -761,7 +761,7 @@ - (void)testMembers - (void)testStateOfRoom { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoomWithMessages:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoomWithMessages:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient stateOfRoom:roomId success:^(NSDictionary *JSONData) { @@ -791,7 +791,7 @@ - (void)testStateOfRoom - (void)testSendTypingNotification { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient sendTypingNotificationInRoom:roomId typing:YES timeout:30000 success:^{ @@ -813,7 +813,7 @@ - (void)testSendTypingNotification - (void)testRedactEvent { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient sendTextMessageToRoom:roomId text:@"This is text message" success:^(NSString *eventId) { @@ -835,7 +835,7 @@ - (void)testRedactEvent - (void)testInitialSyncOfRoom { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoomWithMessages:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoomWithMessages:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient initialSyncOfRoom:roomId withLimit:3 success:^(MXRoomInitialSync *roomInitialSync) { @@ -871,7 +871,7 @@ - (void)testInitialSyncOfRoom - (void)testEventWithEventId { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { NSString *message = @"This is text message"; @@ -903,7 +903,7 @@ - (void)testEventWithEventId - (void)testEventWithEventIdInRoomId { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { NSString *message = @"This is text message"; @@ -935,7 +935,7 @@ - (void)testEventWithEventIdInRoomId - (void)testContextOfEvent { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoomWithMessages:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoomWithMessages:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient initialSyncOfRoom:roomId withLimit:10 success:^(MXRoomInitialSync *roomInitialSync) { @@ -986,7 +986,7 @@ - (void) removeAgeField:(MXRoomInitialSync*)roomInitialSync - (void)testMXRoomMemberEventContent { - [matrixSDKTestsData doMXRestClientTestWithBobAndAliceInARoom:self readyToTest:^(MXRestClient *bobRestClient, MXRestClient *aliceRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndAliceInARoom:self readyToTest:^(MXRestClient *bobRestClient, MXRestClient *aliceRestClient, NSString *roomId, XCTestExpectation *expectation) { [bobRestClient membersOfRoom:roomId success:^(NSArray *roomMemberEvents) { for (MXEvent *roomMemberEvent in roomMemberEvents) @@ -1012,7 +1012,7 @@ - (void)testMXRoomMemberEventContent #pragma mark - Room tags operations - (void)testAddAndRemoveTag { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { // Add a new tag [bobRestClient addTag:@"aTag" withOrder:nil toRoom:roomId success:^{ @@ -1055,7 +1055,7 @@ - (void)testAddAndRemoveTag #pragma mark - Filter operations - (void)testFilter { - [matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { MXFilterJSONModel *filter = [[MXFilterJSONModel alloc] init]; @@ -1116,7 +1116,7 @@ - (void)testFilter #pragma mark - Profile operations - (void)testUserDisplayName { - [matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { __block MXRestClient *aliceRestClient2 = aliceRestClient; @@ -1144,16 +1144,16 @@ - (void)testUserDisplayName - (void)testOtherUserDisplayName { - [matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { // Set the name __block NSString *newDisplayName = @"mxAlice2"; [aliceRestClient setDisplayName:newDisplayName success:^{ - [matrixSDKTestsData doMXRestClientTestWithBob:nil readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation2) { + [self.matrixSDKTestsData doMXRestClientTestWithBob:nil readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation2) { // Then retrieve it from a Bob restClient - [bobRestClient displayNameForUser:matrixSDKTestsData.aliceCredentials.userId success:^(NSString *displayname) { + [bobRestClient displayNameForUser:self.matrixSDKTestsData.aliceCredentials.userId success:^(NSString *displayname) { XCTAssertTrue([displayname isEqualToString:newDisplayName], @"Must retrieved the set string: %@ - %@", displayname, newDisplayName); [expectation fulfill]; @@ -1175,7 +1175,7 @@ - (void)testOtherUserDisplayName // local part of the user id as the default displayname //- (void)testUserNilDisplayName //{ -// [matrixSDKTestsData doMXRestClientTestWithBob:self readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation) { +// [self.matrixSDKTestsData doMXRestClientTestWithBob:self readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation) { // // [bobRestClient displayNameForUser:nil success:^(NSString *displayname) { // @@ -1192,7 +1192,7 @@ - (void)testOtherUserDisplayName - (void)testUserAvatarUrl { - [matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { // Set the avatar url __block NSString *newAvatarUrl = @"http://matrix.org/matrix2.png"; @@ -1218,16 +1218,16 @@ - (void)testUserAvatarUrl - (void)testOtherUserAvatarUrl { - [matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { // Set the avatar url __block NSString *newAvatarUrl = @"http://matrix.org/matrix2.png"; [aliceRestClient setAvatarUrl:newAvatarUrl success:^{ - [matrixSDKTestsData doMXRestClientTestWithBob:nil readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation2) { + [self.matrixSDKTestsData doMXRestClientTestWithBob:nil readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation2) { // Then retrieve it from a Bob restClient - [bobRestClient avatarUrlForUser:matrixSDKTestsData.aliceCredentials.userId success:^(NSString *avatarUrl) { + [bobRestClient avatarUrlForUser:self.matrixSDKTestsData.aliceCredentials.userId success:^(NSString *avatarUrl) { XCTAssertEqualObjects(avatarUrl, newAvatarUrl); [expectation fulfill]; @@ -1250,7 +1250,7 @@ - (void)testOtherUserAvatarUrl - (void)testUserPresence { // Make sure the test is valid once the bug is fixed server side - [matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { __block MXRestClient *aliceRestClient2 = aliceRestClient; @@ -1286,7 +1286,7 @@ - (void)testUserPresence // The test must be updated if those HS default rules change. - (void)testPushRules { - [matrixSDKTestsData doMXRestClientTestWithBob:self readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBob:self readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation) { [bobRestClient pushRules:^(MXPushRulesResponse *pushRules) { @@ -1345,7 +1345,7 @@ - (void)testPushRules #pragma mark - Search - (void)testSearchText { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoomWithMessages:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoomWithMessages:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { MXRoomEventFilter *roomEventFilter = [[MXRoomEventFilter alloc] init]; roomEventFilter.rooms = @[roomId]; @@ -1380,7 +1380,7 @@ - (void)testSearchText - (void)testSearchUniqueTextAcrossRooms { - [matrixSDKTestsData doMXSessionTestWithBobAndARoomWithMessages:self readyToTest:^(MXSession *mxSession, MXRoom *room, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXSessionTestWithBobAndARoomWithMessages:self readyToTest:^(MXSession *mxSession, MXRoom *room, XCTestExpectation *expectation) { NSString *message = [[NSProcessInfo processInfo] globallyUniqueString]; __block NSString *messageEventId; @@ -1423,10 +1423,10 @@ - (void)testSearchUniqueTextAcrossRooms - (void)testSearchPaginate { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { // Add 50 messages to the room - [matrixSDKTestsData for:bobRestClient andRoom:roomId sendMessages:20 testCase:self success:^{ + [self.matrixSDKTestsData for:bobRestClient andRoom:roomId sendMessages:20 testCase:self success:^{ MXRoomEventFilter *roomEventFilter = [[MXRoomEventFilter alloc] init]; roomEventFilter.rooms = @[roomId]; @@ -1497,7 +1497,7 @@ - (void)testSearchPaginate #pragma mark - Users search - (void)testUsersSearch { - [matrixSDKTestsData doMXRestClientTestWithBobAndAliceInARoom:self readyToTest:^(MXRestClient *bobRestClient, MXRestClient *aliceRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndAliceInARoom:self readyToTest:^(MXRestClient *bobRestClient, MXRestClient *aliceRestClient, NSString *roomId, XCTestExpectation *expectation) { // Do a search with no expected results [bobRestClient searchUsers:@"random" limit:1 success:^(MXUserSearchResponse *userSearchResponse) { @@ -1519,7 +1519,7 @@ - (void)testUsersSearch #ifdef MX_CRYPTO - (void)testDeviceKeys { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { NSString *ed25519key = @"wV5E3EUSHpHuoZLljNzojlabjGdXT3Mz7rugG9zgbkI"; @@ -1535,9 +1535,11 @@ - (void)testDeviceKeys [bobRestClient uploadKeys:bobDevice.JSONDictionary oneTimeKeys:nil success:^(MXKeysUploadResponse *keysUploadResponse) { XCTAssert(keysUploadResponse.oneTimeKeyCounts); - XCTAssertEqual(keysUploadResponse.oneTimeKeyCounts.count, 0, @"There is no yet one-time keys"); - - XCTAssertEqual([keysUploadResponse oneTimeKeyCountsForAlgorithm:@"deded"], 0, @"It must response 0 for any algo"); + + [keysUploadResponse.oneTimeKeyCounts enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSNumber *obj, BOOL *stop) { + XCTAssertEqual(obj.unsignedIntValue, 0, @"There shouldn't be any one time keys at this point"); + XCTAssertEqual([keysUploadResponse oneTimeKeyCountsForAlgorithm:key], 0, @"There shouldn't be any one time keys at this point"); + }]; // And download back it [bobRestClient downloadKeysForUsers:@[bobRestClient.credentials.userId] token:nil success:^(MXKeysQueryResponse *keysQueryResponse) { @@ -1569,7 +1571,7 @@ - (void)testDeviceKeys - (void)testOneTimeKeys { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { NSDictionary *otks = @{ @"curve25519:AAAABQ": @"ueuHES/Q0P1MZ4J3IUpC8iQTkgQNX66ZpxVLUaTDuB8", @@ -1578,12 +1580,18 @@ - (void)testOneTimeKeys // Upload the device keys [bobRestClient uploadKeys:nil oneTimeKeys:otks success:^(MXKeysUploadResponse *keysUploadResponse) { - XCTAssert(keysUploadResponse.oneTimeKeyCounts); - XCTAssertEqual(keysUploadResponse.oneTimeKeyCounts.count, 1, @"There is no yet one-time keys"); - XCTAssertEqual([keysUploadResponse oneTimeKeyCountsForAlgorithm:@"curve25519"], 2, @"It must response 2 for 'curve25519'"); - XCTAssertEqual([keysUploadResponse oneTimeKeyCountsForAlgorithm:@"deded"], 0, @"It must response 0 for any other algo"); + [keysUploadResponse.oneTimeKeyCounts enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSNumber *obj, BOOL *stop) { + if ([key isEqualToString:@"curve25519"]) { + XCTAssertEqual(obj.unsignedIntValue, 2, @"Key count must be 2 for 'curve25519'"); + XCTAssertEqual([keysUploadResponse oneTimeKeyCountsForAlgorithm:key], 2, @"Key count must be 2 for 'curve25519'"); + return; + } + + XCTAssertEqual(obj.unsignedIntValue, 0, @"Key count must be 0 for any other algorithm."); + XCTAssertEqual([keysUploadResponse oneTimeKeyCountsForAlgorithm:key], 0, @"Key count must be 0 for any other algorithm."); + }]; [expectation fulfill]; @@ -1596,7 +1604,7 @@ - (void)testOneTimeKeys - (void)testClaimOneTimeKeysForUsersDevices { - [matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBobAndARoom:self readyToTest:^(MXRestClient *bobRestClient, NSString *roomId, XCTestExpectation *expectation) { NSDictionary *otks = @{ @"curve25519:AAAABQ": @{ @@ -1620,7 +1628,7 @@ - (void)testClaimOneTimeKeysForUsersDevices // Upload the device keys [bobRestClient uploadKeys:nil oneTimeKeys:otks success:^(MXKeysUploadResponse *keysUploadResponse) { - [matrixSDKTestsData doMXRestClientTestWithAlice:nil readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation2) { + [self.matrixSDKTestsData doMXRestClientTestWithAlice:nil readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation2) { MXUsersDevicesMap *usersDevicesKeyTypesMap = [[MXUsersDevicesMap alloc] init]; [usersDevicesKeyTypesMap setObject:@"curve25519" forUser:bobRestClient.credentials.userId andDevice:bobRestClient.credentials.deviceId]; @@ -1662,7 +1670,7 @@ - (void)testClaimOneTimeKeysForUsersDevices - (void)testDevices { - [matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { // Get the devices [aliceRestClient devices:^(NSArray *devices){ @@ -1680,7 +1688,7 @@ - (void)testDevices - (void)testDeviceByDeviceId { - [matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { // Get the devices [aliceRestClient devices:^(NSArray *devices){ @@ -1713,7 +1721,7 @@ - (void)testDeviceByDeviceId - (void)testSetDeviceName { - [matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithAlice:self readyToTest:^(MXRestClient *aliceRestClient, XCTestExpectation *expectation) { // Get the devices [aliceRestClient devices:^(NSArray *devices){ @@ -1753,7 +1761,7 @@ - (void)testSetDeviceName - (void)testThirdpartyProtocols { - [matrixSDKTestsData doMXRestClientTestWithBob:self readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation) { + [self.matrixSDKTestsData doMXRestClientTestWithBob:self readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation) { [bobRestClient thirdpartyProtocols:^(MXThirdpartyProtocolsResponse *thirdpartyProtocolsResponse) { diff --git a/MatrixSDKTests/MatrixSDKTestsData.h b/MatrixSDKTests/MatrixSDKTestsData.h index cf594da86d..6b9ed0ca1f 100644 --- a/MatrixSDKTests/MatrixSDKTestsData.h +++ b/MatrixSDKTests/MatrixSDKTestsData.h @@ -41,7 +41,7 @@ FOUNDATION_EXPORT NSString * const kMXTestsAliceAvatarURL; #pragma mark - mxBob // Credentials for the user mxBob on the home server located at kMXTestsHomeServerURL -@property (nonatomic, readonly) MXCredentials *bobCredentials; +@property (nonatomic, strong, readonly) MXCredentials *bobCredentials; // Get credentials asynchronously // The user will be created if needed @@ -91,7 +91,7 @@ FOUNDATION_EXPORT NSString * const kMXTestsAliceAvatarURL; #pragma mark - mxAlice -@property (nonatomic, readonly) MXCredentials *aliceCredentials; +@property (nonatomic, strong, readonly) MXCredentials *aliceCredentials; - (void)doMXRestClientTestWithAlice:(XCTestCase*)testCase readyToTest:(void (^)(MXRestClient *aliceRestClient, XCTestExpectation *expectation))readyToTest; @@ -104,8 +104,8 @@ FOUNDATION_EXPORT NSString * const kMXTestsAliceAvatarURL; #pragma mark - both // The id and alias used for the public room created with *ThePublicRoom* methods -@property (nonatomic,readonly) NSString *thePublicRoomId; -@property (nonatomic,readonly) NSString *thePublicRoomAlias; +@property (nonatomic, strong, readonly) NSString *thePublicRoomId; +@property (nonatomic, strong, readonly) NSString *thePublicRoomAlias; - (void)doMXRestClientTestWithBobAndAliceInARoom:(XCTestCase*)testCase readyToTest:(void (^)(MXRestClient *bobRestClient, MXRestClient *aliceRestClient, NSString* roomId, XCTestExpectation *expectation))readyToTest; diff --git a/MatrixSDKTests/MatrixSDKTestsData.m b/MatrixSDKTests/MatrixSDKTestsData.m index f7cb45e54c..52996b7990 100644 --- a/MatrixSDKTests/MatrixSDKTestsData.m +++ b/MatrixSDKTests/MatrixSDKTestsData.m @@ -42,29 +42,35 @@ @interface MatrixSDKTestsData () -{ - NSDate *startDate; - NSMutableArray *retainedObjects; -} +@property (nonatomic, strong, readonly)NSDate *startDate; + +@property (nonatomic, strong, readonly) NSMutableArray *retainedObjects; + +@property (nonatomic, strong) MXCredentials *aliceCredentials; +@property (nonatomic, strong) MXCredentials *bobCredentials; + +@property (nonatomic, strong) NSString *thePublicRoomId; +@property (nonatomic, strong) NSString *thePublicRoomAlias; + @end @implementation MatrixSDKTestsData - (id)init { - self = [super init]; - if (self) + if (self = [super init]) { - startDate = [NSDate date]; - retainedObjects = [NSMutableArray array]; + _startDate = [NSDate date]; + _retainedObjects = [NSMutableArray array]; } + return self; } - (void)dealloc { - retainedObjects = [NSMutableArray array]; + _retainedObjects = [NSMutableArray array]; } - (void)getBobCredentials:(XCTestCase*)testCase @@ -87,7 +93,7 @@ - (void)getBobCredentials:(XCTestCase*)testCase // First, try register the user MXHTTPOperation *operation = [mxRestClient registerWithLoginType:kMXLoginFlowTypeDummy username:bobUniqueUser password:MXTESTS_BOB_PWD success:^(MXCredentials *credentials) { - _bobCredentials = credentials; + self.bobCredentials = credentials; readyToTest(); } failure:^(NSError *error) { @@ -98,7 +104,7 @@ - (void)getBobCredentials:(XCTestCase*)testCase // Log Bob in to get his keys [mxRestClient loginWithLoginType:kMXLoginFlowTypeDummy username:bobUniqueUser password:MXTESTS_BOB_PWD success:^(MXCredentials *credentials) { - _bobCredentials = credentials; + self.bobCredentials = credentials; readyToTest(); } failure:^(NSError *error) { @@ -193,22 +199,22 @@ - (void)doMXRestClientTestWithBobAndThePublicRoom:(XCTestCase*)testCase { [self doMXRestClientTestWithBob:testCase readyToTest:^(MXRestClient *bobRestClient, XCTestExpectation *expectation) { - if (_thePublicRoomId) + if (self.thePublicRoomId) { - readyToTest(bobRestClient, _thePublicRoomId, expectation); + readyToTest(bobRestClient, self.thePublicRoomId, expectation); } else { // Create a public room starting with #mxPublic - _thePublicRoomAlias = [NSString stringWithFormat:@"mxPublic-%@", [[NSUUID UUID] UUIDString]]; + self.thePublicRoomAlias = [NSString stringWithFormat:@"mxPublic-%@", [[NSUUID UUID] UUIDString]]; [bobRestClient createRoom:@"MX Public Room test" visibility:kMXRoomDirectoryVisibilityPublic - roomAlias:_thePublicRoomAlias + roomAlias:self.thePublicRoomAlias topic:@"The public room used by SDK tests" success:^(MXCreateRoomResponse *response) { - _thePublicRoomId = response.roomId; + self.thePublicRoomId = response.roomId; readyToTest(bobRestClient, response.roomId, expectation); } failure:^(NSError *error) { @@ -303,7 +309,7 @@ - (void)for:(MXRestClient *)mxRestClient2 andRoom:(NSString*)roomId sendMessages } else { - [mxRestClient2 sendTextMessageToRoom:roomId text:[NSString stringWithFormat:@"Fake message sent at %.0f ms", [[NSDate date] timeIntervalSinceDate:startDate] * 1000] + [mxRestClient2 sendTextMessageToRoom:roomId text:[NSString stringWithFormat:@"Fake message sent at %.0f ms", [[NSDate date] timeIntervalSinceDate:self.startDate] * 1000] success:^(NSString *eventId) { // Send the next message @@ -471,7 +477,7 @@ - (void)getAliceCredentials:(XCTestCase*)testCase // First, try register the user MXHTTPOperation *operation = [mxRestClient registerWithLoginType:kMXLoginFlowTypeDummy username:aliceUniqueUser password:MXTESTS_ALICE_PWD success:^(MXCredentials *credentials) { - _aliceCredentials = credentials; + self.aliceCredentials = credentials; readyToTest(); } failure:^(NSError *error) { @@ -482,7 +488,7 @@ - (void)getAliceCredentials:(XCTestCase*)testCase // Log Alice in to get his keys [mxRestClient loginWithLoginType:kMXLoginFlowTypeDummy username:aliceUniqueUser password:MXTESTS_ALICE_PWD success:^(MXCredentials *credentials) { - _aliceCredentials = credentials; + self.aliceCredentials = credentials; readyToTest(); } failure:^(NSError *error) { @@ -757,7 +763,7 @@ - (void)getHttpsBobCredentials:(XCTestCase*)testCase // First, try register the user MXHTTPOperation *operation = [mxRestClient registerWithLoginType:kMXLoginFlowTypeDummy username:bobUniqueUser password:MXTESTS_BOB_PWD success:^(MXCredentials *credentials) { - _bobCredentials = credentials; + self.bobCredentials = credentials; readyToTest(); } failure:^(NSError *error) { @@ -768,7 +774,7 @@ - (void)getHttpsBobCredentials:(XCTestCase*)testCase // Log Bob in to get his keys [mxRestClient loginWithLoginType:kMXLoginFlowTypeDummy username:bobUniqueUser password:MXTESTS_BOB_PWD success:^(MXCredentials *credentials) { - _bobCredentials = credentials; + self.bobCredentials = credentials; readyToTest(); } failure:^(NSError *error) { @@ -1009,7 +1015,7 @@ - (void)loginUserOnANewDevice:(XCTestCase*)testCase #pragma mark Reference keeping - (void)retain:(NSObject*)object { - [retainedObjects addObject:object]; + [self.retainedObjects addObject:object]; } @end