IOSAD-103 test timeout constant IOSAD-103
authorDirk Zimmermann <dirk@pep-project.org>
Wed, 31 Oct 2018 16:38:25 +0100
branchIOSAD-103
changeset 75478dbef38ae98
parent 753 ff33ee63be39
child 755 97e5610f11df
IOSAD-103 test timeout constant
pEpObjCTests/PEPSessionTest.m
pEpObjCTests/TestUtils/PEPTestUtils.h
pEpObjCTests/TestUtils/PEPTestUtils.m
     1.1 --- a/pEpObjCTests/PEPSessionTest.m	Wed Oct 31 16:38:25 2018 +0100
     1.2 +++ b/pEpObjCTests/PEPSessionTest.m	Wed Oct 31 16:38:25 2018 +0100
     1.3 @@ -1223,7 +1223,7 @@
     1.4  
     1.5      XCTAssertNotNil(identMe.fingerPrint);
     1.6  
     1.7 -    [self waitForExpectations:@[expHaveMessage] timeout:20];
     1.8 +    [self waitForExpectations:@[expHaveMessage] timeout:PEPTestInternalSyncTimeout];
     1.9  
    1.10      XCTAssertEqual(self.sendMessageDelegate.messages.count, 1);
    1.11  }
    1.12 @@ -1236,6 +1236,10 @@
    1.13  
    1.14      XCTAssertEqual(self.sendMessageDelegate.messages.count, 0);
    1.15  
    1.16 +    XCTKVOExpectation *expHaveMessage = [[XCTKVOExpectation alloc]
    1.17 +                                         initWithKeyPath:@"lastMessage"
    1.18 +                                         object:self.sendMessageDelegate];
    1.19 +
    1.20      PEPIdentity *identMe = [[PEPIdentity alloc]
    1.21                              initWithAddress:@"me-myself-and-i@pep-project.org"
    1.22                              userID:@"me-myself-and-i"
    1.23 @@ -1256,11 +1260,7 @@
    1.24      XCTAssertNotNil(identMe.fingerPrint);
    1.25      XCTAssertNotEqual(identMe.fingerPrint, fpr1);
    1.26  
    1.27 -    XCTKVOExpectation *expHaveMessage = [[XCTKVOExpectation alloc]
    1.28 -                                         initWithKeyPath:@"lastMessage"
    1.29 -                                         object:self.sendMessageDelegate];
    1.30 -
    1.31 -    [self waitForExpectations:@[expHaveMessage] timeout:1000];
    1.32 +    [self waitForExpectations:@[expHaveMessage] timeout:PEPTestInternalSyncTimeout];
    1.33  
    1.34      XCTAssertEqual(self.sendMessageDelegate.messages.count, 1);
    1.35  }
     2.1 --- a/pEpObjCTests/TestUtils/PEPTestUtils.h	Wed Oct 31 16:38:25 2018 +0100
     2.2 +++ b/pEpObjCTests/TestUtils/PEPTestUtils.h	Wed Oct 31 16:38:25 2018 +0100
     2.3 @@ -17,6 +17,11 @@
     2.4  
     2.5  extern NSString * const ownUserId;
     2.6  
     2.7 +/**
     2.8 + Timeout for internal sync operations.
     2.9 + */
    2.10 +extern const NSInteger PEPTestInternalSyncTimeout;
    2.11 +
    2.12  @interface PEPTestUtils : NSObject
    2.13  
    2.14  + (PEPIdentity *)foreignPepIdentityWithAddress:(NSString *)address userName:(NSString *)username;
     3.1 --- a/pEpObjCTests/TestUtils/PEPTestUtils.m	Wed Oct 31 16:38:25 2018 +0100
     3.2 +++ b/pEpObjCTests/TestUtils/PEPTestUtils.m	Wed Oct 31 16:38:25 2018 +0100
     3.3 @@ -23,6 +23,8 @@
     3.4   */
     3.5  NSString * const ownUserId = @"pEp_own_userId";
     3.6  
     3.7 +const NSInteger PEPTestInternalSyncTimeout = 20;
     3.8 +
     3.9  @implementation PEPTestUtils
    3.10  
    3.11  + (PEPIdentity *)foreignPepIdentityWithAddress:(NSString *)address userName:(NSString *)username;