IOS-937 rm suspicious duplicate
authorDirk Zimmermann <dirk@pep-project.org>
Fri, 09 Feb 2018 16:33:31 +0100
changeset 44706f6fb54ee8e
parent 446 70bb6386c76f
child 448 dc48743fd54c
IOS-937 rm suspicious duplicate
pEpObjCTests/PEPInternalSessionTest.m
     1.1 --- a/pEpObjCTests/PEPInternalSessionTest.m	Fri Feb 09 16:08:10 2018 +0100
     1.2 +++ b/pEpObjCTests/PEPInternalSessionTest.m	Fri Feb 09 16:33:31 2018 +0100
     1.3 @@ -195,138 +195,6 @@
     1.4      [self pEpCleanUp];
     1.5  }
     1.6  
     1.7 -- (void)testOutgoingColors
     1.8 -{
     1.9 -    [self pEpSetUp];
    1.10 -
    1.11 -    // Our test user :
    1.12 -    // pEp Test Alice (test key don't use) <pep.test.alice@pep-project.org>
    1.13 -    // 4ABE3AAF59AC32CFE4F86500A9411D176FF00E97
    1.14 -    [PEPTestUtils importBundledKey:@"6FF00E97_sec.asc"];
    1.15 -
    1.16 -    NSString *myFpr = @"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97";
    1.17 -    PEPIdentity *identAlice = [[PEPIdentity alloc]
    1.18 -                               initWithAddress:@"pep.test.alice@pep-project.org"
    1.19 -                               userID:ownUserId
    1.20 -                               userName:@"pEp Test Alice"
    1.21 -                               isOwn:YES
    1.22 -                               fingerPrint:myFpr];
    1.23 -    [self.session mySelf:identAlice];
    1.24 -    XCTAssertEqualObjects(identAlice.fingerPrint, myFpr);
    1.25 -
    1.26 -    PEPMessage *msg = [PEPMessage new];
    1.27 -    msg.from = identAlice;
    1.28 -    msg.to = @[[[PEPIdentity alloc] initWithAddress:@"pep.test.bob@pep-project.org"
    1.29 -                                             userID: @"42"
    1.30 -                                           userName:@"pEp Test Bob"
    1.31 -                                              isOwn:NO]];
    1.32 -    msg.shortMessage = @"All Green Test";
    1.33 -    msg.longMessage = @"This is a text content";
    1.34 -    msg.direction = PEP_dir_outgoing;
    1.35 -
    1.36 -    // Test with unknown Bob
    1.37 -    PEP_rating clr = [self.session outgoingColorForMessage:msg];
    1.38 -    XCTAssertEqual(clr, PEP_rating_unencrypted);
    1.39 -
    1.40 -    // Now let see with bob's pubkey already known
    1.41 -    // pEp Test Bob (test key, don't use) <pep.test.bob@pep-project.org>
    1.42 -    // BFCDB7F301DEEEBBF947F29659BFF488C9C2EE39
    1.43 -    [PEPTestUtils importBundledKey:@"0xC9C2EE39.asc"];
    1.44 -
    1.45 -    NSString *bobsFingerprint = @"BFCDB7F301DEEEBBF947F29659BFF488C9C2EE39";
    1.46 -    PEPIdentity *identBob = [[PEPIdentity alloc]
    1.47 -                             initWithAddress:@"pep.test.bob@pep-project.org"
    1.48 -                             userID:@"42" userName:@"pEp Test Bob"
    1.49 -                             isOwn:NO
    1.50 -                             fingerPrint:bobsFingerprint];
    1.51 -
    1.52 -    [self.session updateIdentity:identBob];
    1.53 -    XCTAssertNotNil(identBob.fingerPrint);
    1.54 -    XCTAssertEqualObjects(identBob.fingerPrint, bobsFingerprint);
    1.55 -
    1.56 -    // Test if the engine indeed accepted the key
    1.57 -    identBob.fingerPrint = nil;
    1.58 -    [self.session updateIdentity:identBob];
    1.59 -    XCTAssertNotNil(identBob.fingerPrint);
    1.60 -    XCTAssertEqualObjects(identBob.fingerPrint, bobsFingerprint);
    1.61 -
    1.62 -    // Should be yellow, since no handshake happened.
    1.63 -    clr = [self.session outgoingColorForMessage:msg];
    1.64 -    XCTAssertEqual(clr, PEP_rating_reliable);
    1.65 -
    1.66 -    clr = [self.session identityRating:identBob];
    1.67 -    XCTAssertEqual(clr, PEP_rating_reliable);
    1.68 -
    1.69 -    // Let' say we got that handshake, set PEP_ct_confirmed in Bob's identity
    1.70 -    [self.session trustPersonalKey:identBob];
    1.71 -
    1.72 -    // This time it should be green
    1.73 -    clr = [self.session outgoingColorForMessage:msg];
    1.74 -    XCTAssertEqual(clr, PEP_rating_trusted);
    1.75 -
    1.76 -    clr = [self.session identityRating:identBob];
    1.77 -    XCTAssertEqual(clr, PEP_rating_trusted);
    1.78 -
    1.79 -    // Let' say we undo handshake
    1.80 -    [self.session keyResetTrust:identBob];
    1.81 -
    1.82 -    // Yellow ?
    1.83 -    clr = [self.session outgoingColorForMessage:msg];
    1.84 -    XCTAssertEqual(clr, PEP_rating_reliable);
    1.85 -
    1.86 -    // mistrust Bob
    1.87 -    [self.session keyMistrusted:identBob];
    1.88 -
    1.89 -    // Gray == PEP_rating_unencrypted
    1.90 -    clr = [self.session outgoingColorForMessage:msg];
    1.91 -    XCTAssertEqual(clr, PEP_rating_unencrypted);
    1.92 -
    1.93 -    // Forget
    1.94 -    [self.session keyResetTrust:identBob];
    1.95 -
    1.96 -    // Back to yellow
    1.97 -    clr = [self.session outgoingColorForMessage:msg];
    1.98 -    XCTAssertEqual(clr, PEP_rating_reliable);
    1.99 -
   1.100 -    // Trust again
   1.101 -    [self.session trustPersonalKey:identBob];
   1.102 -
   1.103 -    // Back to green
   1.104 -    clr = [self.session outgoingColorForMessage:msg];
   1.105 -    XCTAssertEqual(clr, PEP_rating_trusted);
   1.106 -
   1.107 -    // Now let see if it turns back yellow if we add an unconfirmed folk.
   1.108 -    // pEp Test John (test key, don't use) <pep.test.john@pep-project.org>
   1.109 -    // AA2E4BEB93E5FE33DEFD8BE1135CD6D170DCF575
   1.110 -    [PEPTestUtils importBundledKey:@"0x70DCF575.asc"];
   1.111 -
   1.112 -    PEPIdentity *identJohn = [[PEPIdentity alloc]
   1.113 -                              initWithAddress:@"pep.test.john@pep-project.org"
   1.114 -                              userID:@"101" userName:@"pEp Test John"
   1.115 -                              isOwn:NO
   1.116 -                              fingerPrint:@"AA2E4BEB93E5FE33DEFD8BE1135CD6D170DCF575"];
   1.117 -
   1.118 -    [self.session updateIdentity:identJohn];
   1.119 -
   1.120 -    msg.cc = @[[PEPTestUtils foreignPepIdentityWithAddress:@"pep.test.john@pep-project.org"
   1.121 -                                                  userName:@"pEp Test John"]];
   1.122 -    // Yellow ?
   1.123 -    clr = [self.session outgoingColorForMessage:msg];
   1.124 -    XCTAssertEqual(clr, PEP_rating_reliable);
   1.125 -
   1.126 -    PEPMessage *encmsg;
   1.127 -    PEP_STATUS status = [self.session encryptMessage:msg extra:@[] dest:&encmsg];
   1.128 -
   1.129 -    XCTAssertNotNil(encmsg);
   1.130 -    XCTAssertEqualObjects(encmsg.shortMessage, @"p≡p");
   1.131 -    XCTAssertTrue([encmsg.longMessage containsString:@"p≡p"]);
   1.132 -
   1.133 -    XCTAssertEqual(status, PEP_STATUS_OK);
   1.134 -
   1.135 -    [self pEpCleanUp];
   1.136 -}
   1.137 -
   1.138 -
   1.139  - (void)testOutgoingBccColors
   1.140  {
   1.141      [self pEpSetUp];