IOSAD-172 Test passphrase timeout reset IOSAD-172
authorDirk Zimmermann <dz@pep.security>
Mon, 29 Jun 2020 16:39:43 +0200
branchIOSAD-172
changeset 15464a258d6b7b93
parent 1545 5ca27ed9f55b
child 1547 516474ecf260
IOSAD-172 Test passphrase timeout reset
pEpObjCTests/PEPPassphraseCacheTest.m
     1.1 --- a/pEpObjCTests/PEPPassphraseCacheTest.m	Mon Jun 29 16:39:43 2020 +0200
     1.2 +++ b/pEpObjCTests/PEPPassphraseCacheTest.m	Mon Jun 29 16:39:43 2020 +0200
     1.3 @@ -105,6 +105,26 @@
     1.4      XCTAssertEqualObjects(ownCache.passphrases, @[@""]);
     1.5  }
     1.6  
     1.7 +- (void)testResetTimeout
     1.8 +{
     1.9 +    NSString *passphrase1 = @"somepass1";
    1.10 +    NSString *passphrase2 = @"somepass2";
    1.11 +    NSString *passphrase3 = @"somepass3";
    1.12 +
    1.13 +    [self.cache addPassphrase:passphrase1];
    1.14 +    [self.cache addPassphrase:passphrase2];
    1.15 +    [self.cache addPassphrase:passphrase3];
    1.16 +
    1.17 +    [self.cache resetTimeoutForPassphrase:passphrase1];
    1.18 +
    1.19 +    NSArray *expected1 = @[@"", passphrase1, passphrase3, passphrase2];
    1.20 +    XCTAssertEqualObjects(self.cache.passphrases, expected1);
    1.21 +
    1.22 +    [self.cache resetTimeoutForPassphrase:passphrase3];
    1.23 +    NSArray *expected2 = @[@"", passphrase3, passphrase1, passphrase2];
    1.24 +    XCTAssertEqualObjects(self.cache.passphrases, expected2);
    1.25 +}
    1.26 +
    1.27  #pragma mark - Helpers
    1.28  
    1.29  - (NSArray *)reversedArray:(NSArray *)array