IOSAD-134 Test for querying sync state. IOSAD-134
authorDirk Zimmermann <dz@pep.security>
Mon, 02 Sep 2019 16:47:25 +0200
branchIOSAD-134
changeset 119131441cbef9ef
parent 1190 3a53851cc0b9
child 1192 ecbedb9e389f
IOSAD-134 Test for querying sync state.
pEpObjCTests/PEPSessionTest.m
     1.1 --- a/pEpObjCTests/PEPSessionTest.m	Mon Sep 02 16:47:25 2019 +0200
     1.2 +++ b/pEpObjCTests/PEPSessionTest.m	Mon Sep 02 16:47:25 2019 +0200
     1.3 @@ -1321,7 +1321,7 @@
     1.4  
     1.5  #pragma mark - enable/disable sync
     1.6  
     1.7 -- (void)testEnableDisableSyncOnOwnIdentity
     1.8 +- (void)testEnableDisableSyncOnOwnIdentityWithQuery
     1.9  {
    1.10      PEPSession *session = [PEPSession new];
    1.11  
    1.12 @@ -1336,12 +1336,24 @@
    1.13  
    1.14      for (int i = 0; i < 10; ++i) {
    1.15          error = nil;
    1.16 +        BOOL expected = YES;
    1.17          if (i % 2 == 0) {
    1.18              XCTAssertTrue([session enableSyncForIdentity:identMe error:&error]);
    1.19 +            expected = YES;
    1.20          } else {
    1.21              XCTAssertTrue([session disableSyncForIdentity:identMe error:&error]);
    1.22 +            expected = NO;
    1.23          }
    1.24          XCTAssertNil(error);
    1.25 +
    1.26 +        NSNumber *keySyncState = [session queryKeySyncEnabledForIdentity:identMe error:&error];
    1.27 +        XCTAssertNil(error);
    1.28 +        XCTAssertNotNil(keySyncState);
    1.29 +        if (expected) {
    1.30 +            XCTAssertTrue([keySyncState boolValue]);
    1.31 +        } else {
    1.32 +            XCTAssertFalse([keySyncState boolValue]);
    1.33 +        }
    1.34      }
    1.35  }
    1.36