IOSAD-172 Let the right password succeed IOSAD-172
authorDirk Zimmermann <dz@pep.security>
Mon, 29 Jun 2020 16:39:43 +0200
branchIOSAD-172
changeset 15565128af22e520
parent 1555 161380061370
child 1557 797cf3b33dc1
IOSAD-172 Let the right password succeed
pEpObjCTests/PEPSessionTest.m
     1.1 --- a/pEpObjCTests/PEPSessionTest.m	Mon Jun 29 16:39:43 2020 +0200
     1.2 +++ b/pEpObjCTests/PEPSessionTest.m	Mon Jun 29 16:39:43 2020 +0200
     1.3 @@ -1499,13 +1499,16 @@
     1.4  
     1.5  - (void)testOwnKeyWithPasswordAndEncryptToSelf
     1.6  {
     1.7 -    NSString *passphrase = @"passphrase";
     1.8 +    NSString *correctPassphrase = @"passphrase";
     1.9  
    1.10      PEPSession *session = [PEPSession new];
    1.11  
    1.12      NSError *error = nil;
    1.13  
    1.14 -    XCTAssertTrue([session configurePassphraseForNewKeys:passphrase enable:YES error:&error]);
    1.15 +    XCTAssertTrue([session
    1.16 +                   configurePassphraseForNewKeys:correctPassphrase
    1.17 +                   enable:YES
    1.18 +                   error:&error]);
    1.19  
    1.20      PEPIdentity *identMeWithPassphrase = [[PEPIdentity alloc]
    1.21                                            initWithAddress:@"me-myself-and-i@pep-project.org"
    1.22 @@ -1559,6 +1562,22 @@
    1.23      XCTAssertNotNil(error);
    1.24      XCTAssertEqualObjects(error.domain, PEPObjCAdapterEngineStatusErrorDomain);
    1.25      XCTAssertEqual(error.code, PEPStatusWrongPassphrase);
    1.26 +
    1.27 +    error = nil;
    1.28 +
    1.29 +    XCTAssertTrue([session configurePassphrase:correctPassphrase error:&error]);
    1.30 +    XCTAssertNil(error);
    1.31 +
    1.32 +    error = nil;
    1.33 +    status = PEPStatusOutOfMemory;
    1.34 +
    1.35 +    XCTAssertTrue([session
    1.36 +                   encryptMessage:draftMail
    1.37 +                   forSelf:identMeWithPassphrase
    1.38 +                   extraKeys:nil
    1.39 +                   status:&status
    1.40 +                   error:&error]);
    1.41 +    XCTAssertNil(error);
    1.42  }
    1.43  
    1.44  #pragma mark - Helpers