IOSAD-72 test case for ENGINE-409
authorDirk Zimmermann <dirk@pep-project.org>
Fri, 16 Mar 2018 15:10:02 +0100
changeset 546725069619f4b
parent 545 7217e3c844e0
child 547 a0c9be26f48a
IOSAD-72 test case for ENGINE-409
pEpObjCTests/PEPSessionTest.m
     1.1 --- a/pEpObjCTests/PEPSessionTest.m	Fri Mar 16 15:10:01 2018 +0100
     1.2 +++ b/pEpObjCTests/PEPSessionTest.m	Fri Mar 16 15:10:02 2018 +0100
     1.3 @@ -213,6 +213,42 @@
     1.4      XCTAssertEqual([self ratingForIdentity:alice session:session], PEP_rating_reliable);
     1.5  }
     1.6  
     1.7 +/** ENGINE-409 */
     1.8 +- (void)testIdentityRatingMistrustReset
     1.9 +{
    1.10 +    PEPSession *session = [PEPSession new];
    1.11 +
    1.12 +    PEPIdentity *me = [[PEPIdentity alloc]
    1.13 +                       initWithAddress:@"me@example.org"
    1.14 +                       userID:@"me_myself"
    1.15 +                       userName:@"Me Me"
    1.16 +                       isOwn:YES];
    1.17 +
    1.18 +    NSError *error = nil;
    1.19 +    XCTAssertTrue([session mySelf:me error:&error]);
    1.20 +    XCTAssertNil(error);
    1.21 +
    1.22 +    XCTAssertNotNil(me.fingerPrint);
    1.23 +    XCTAssertEqual([self ratingForIdentity:me session:session], PEP_rating_trusted_and_anonymized);
    1.24 +
    1.25 +    PEPIdentity *alice = [self
    1.26 +                          checkImportingKeyFilePath:@"6FF00E97_sec.asc"
    1.27 +                          address:@"pep.test.alice@pep-project.org"
    1.28 +                          userID:@"This Is Alice"
    1.29 +                          fingerPrint:@"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97"
    1.30 +                          session: session];
    1.31 +    XCTAssertNotNil(alice);
    1.32 +    XCTAssertEqual([self ratingForIdentity:alice session:session], PEP_rating_reliable);
    1.33 +
    1.34 +    XCTAssertTrue([session keyMistrusted:alice error:&error]);
    1.35 +    XCTAssertNil(error);
    1.36 +    XCTAssertEqual([self ratingForIdentity:alice session:session], PEP_rating_have_no_key);
    1.37 +
    1.38 +    XCTAssertFalse([session keyResetTrust:alice error:&error]);
    1.39 +    XCTAssertNotNil(error);
    1.40 +    XCTAssertEqual([self ratingForIdentity:alice session:session], PEP_rating_have_no_key);
    1.41 +}
    1.42 +
    1.43  - (void)testIdentityRatingTrustResetMistrustUndo
    1.44  {
    1.45      PEPSession *session = [PEPSession new];