IOSAD-172 Test for no password and wrong password IOSAD-172
authorDirk Zimmermann <dz@pep.security>
Mon, 29 Jun 2020 16:39:43 +0200
branchIOSAD-172
changeset 1555161380061370
parent 1554 fa5d57d941ab
child 1556 5128af22e520
IOSAD-172 Test for no password and wrong password
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 @@ -1541,6 +1541,24 @@
     1.4      XCTAssertNotNil(error);
     1.5      XCTAssertEqualObjects(error.domain, PEPObjCAdapterEngineStatusErrorDomain);
     1.6      XCTAssertEqual(error.code, PEPStatusPassphraseRequired);
     1.7 +
     1.8 +    error = nil;
     1.9 +
    1.10 +    XCTAssertTrue([session configurePassphrase:@"wrong passphrase" error:&error]);
    1.11 +    XCTAssertNil(error);
    1.12 +
    1.13 +    error = nil;
    1.14 +    status = PEPStatusOutOfMemory;
    1.15 +
    1.16 +    XCTAssertFalse([session
    1.17 +                    encryptMessage:draftMail
    1.18 +                    forSelf:identMeWithPassphrase
    1.19 +                    extraKeys:nil
    1.20 +                    status:&status
    1.21 +                    error:&error]);
    1.22 +    XCTAssertNotNil(error);
    1.23 +    XCTAssertEqualObjects(error.domain, PEPObjCAdapterEngineStatusErrorDomain);
    1.24 +    XCTAssertEqual(error.code, PEPStatusWrongPassphrase);
    1.25  }
    1.26  
    1.27  #pragma mark - Helpers