IOSAD-95 trying testEncryptedMailFromMuttWithTrustedServerOrNot
authorDirk Zimmermann <dirk@pep-project.org>
Mon, 18 Jun 2018 11:37:19 +0200
changeset 6316c9a4f311de7
parent 630 ac0b9f0507ba
child 632 463397b4646f
IOSAD-95 trying testEncryptedMailFromMuttWithTrustedServerOrNot
pEpObjCTests/PEPSessionTest.m
     1.1 --- a/pEpObjCTests/PEPSessionTest.m	Mon Jun 18 11:37:18 2018 +0200
     1.2 +++ b/pEpObjCTests/PEPSessionTest.m	Mon Jun 18 11:37:19 2018 +0200
     1.3 @@ -854,7 +854,13 @@
     1.4      XCTAssertEqual(rating, PEP_rating_trusted_and_anonymized);
     1.5  }
     1.6  
     1.7 -- (void)testEncryptedMailFromMuttWithReencryption
     1.8 +- (void)testEncryptedMailFromMuttWithTrustedServerOrNot
     1.9 +{
    1.10 +    [self testEncryptedMailFromMuttWithTrustedServer:NO];
    1.11 +    [self testEncryptedMailFromMuttWithTrustedServer:YES];
    1.12 +}
    1.13 +
    1.14 +- (void)testEncryptedMailFromMuttWithTrustedServer:(BOOL)trustedServer
    1.15  {
    1.16      PEPSession *session = [PEPSession new];
    1.17  
    1.18 @@ -895,7 +901,11 @@
    1.19      XCTAssertEqualObjects(msg, msgOriginal);
    1.20  
    1.21      PEP_rating rating = PEP_rating_undefined;
    1.22 +
    1.23      PEP_decrypt_flags flags = PEP_decrypt_flag_untrusted_server;
    1.24 +    if (trustedServer) {
    1.25 +        flags = 0;
    1.26 +    }
    1.27  
    1.28      PEPMessage *pepDecryptedMail = [session
    1.29                                      decryptMessage:msg
    1.30 @@ -910,8 +920,9 @@
    1.31      // Technically, the mail is encrypted, but the signatures don't match
    1.32      XCTAssertEqual(rating, PEP_rating_unreliable);
    1.33  
    1.34 -    // Since we're requesting re-encryption, src should have been changed
    1.35 -    XCTAssertNotEqualObjects(msg, msgOriginal);
    1.36 +    if (trustedServer) {
    1.37 +        XCTAssertNotEqualObjects(msg, msgOriginal);
    1.38 +    }
    1.39  
    1.40      XCTAssertNotNil(pepDecryptedMail.longMessage);
    1.41  }