ENGINE-684 Test
authorDirk Zimmermann <dz@pep.security>
Thu, 05 Dec 2019 16:31:46 +0100
changeset 137913b2d34e6ba9
parent 1378 bfe8a5677105
child 1380 16ab750dfe6a
child 1386 e3d0fa030830
child 1401 7915afcc725c
ENGINE-684 Test
pEpObjCTests/PEPSessionTest.m
     1.1 --- a/pEpObjCTests/PEPSessionTest.m	Wed Dec 04 08:10:31 2019 +0100
     1.2 +++ b/pEpObjCTests/PEPSessionTest.m	Thu Dec 05 16:31:46 2019 +0100
     1.3 @@ -1291,6 +1291,38 @@
     1.4      [self shutdownSync];
     1.5  }
     1.6  
     1.7 +/// ENGINE-684
     1.8 +- (void)testMyselfWithQueryKeySyncEnabledForIdentity
     1.9 +{
    1.10 +    PEPSession *session = [PEPSession new];
    1.11 +
    1.12 +    PEPIdentity *identMeEnabled = [[PEPIdentity alloc]
    1.13 +                                   initWithAddress:@"me-myself-and-i-enabled@pep-project.org"
    1.14 +                                   userID:@"me-myself-and-i-enabled"
    1.15 +                                   userName:@"pEp Me Enabled"
    1.16 +                                   isOwn:YES];
    1.17 +
    1.18 +    PEPIdentity *identMeDisabled = [[PEPIdentity alloc]
    1.19 +                                    initWithAddress:@"me-myself-and-i-disabled@pep-project.org"
    1.20 +                                    userID:@"me-myself-and-i-disabled"
    1.21 +                                    userName:@"pEp Me Disabled"
    1.22 +                                    isOwn:YES];
    1.23 +
    1.24 +    for (PEPIdentity *ident in @[identMeEnabled, identMeDisabled]) {
    1.25 +        BOOL expectEnabled = ident == identMeEnabled ? YES : NO;
    1.26 +
    1.27 +        NSError *error = nil;
    1.28 +        XCTAssertTrue([session mySelf:identMeEnabled pEpSyncEnabled:expectEnabled error:&error]);
    1.29 +        XCTAssertNil(error);
    1.30 +
    1.31 +        NSNumber *enabledNum = [session queryKeySyncEnabledForIdentity:identMeEnabled error:&error];
    1.32 +        XCTAssertNotNil(enabledNum);
    1.33 +        XCTAssertNil(error);
    1.34 +
    1.35 +        XCTAssertEqual([enabledNum boolValue], expectEnabled);
    1.36 +    }
    1.37 +}
    1.38 +
    1.39  #pragma mark - key_reset_identity
    1.40  
    1.41  - (void)testKeyResetIdentity