pEpObjCTests/PEPPassphraseCacheTest.m
branchIOSAD-172
changeset 1572 f35650fadd3d
parent 1549 cf7b3b9c0e96
     1.1 --- a/pEpObjCTests/PEPPassphraseCacheTest.m	Tue Jun 30 17:00:20 2020 +0200
     1.2 +++ b/pEpObjCTests/PEPPassphraseCacheTest.m	Tue Jun 30 17:00:20 2020 +0200
     1.3 @@ -26,16 +26,16 @@
     1.4  
     1.5  - (void)testContainsEmptyPassphrase
     1.6  {
     1.7 -    XCTAssertEqual(self.cache.passphrases.count, 1);
     1.8 -    XCTAssertEqualObjects(self.cache.passphrases, @[@""]);
     1.9 +    XCTAssertEqual(self.cache.passphrases.count, 0);
    1.10 +    XCTAssertEqualObjects(self.cache.passphrases, @[]);
    1.11  }
    1.12  
    1.13  - (void)testContainsSetPassphrase
    1.14  {
    1.15      NSString *passphrase = @"somepass";
    1.16      [self.cache addPassphrase:passphrase];
    1.17 -    XCTAssertEqual(self.cache.passphrases.count, 2);
    1.18 -    NSArray *expected = @[@"", passphrase];
    1.19 +    XCTAssertEqual(self.cache.passphrases.count, 1);
    1.20 +    NSArray *expected = @[passphrase];
    1.21      XCTAssertEqualObjects(self.cache.passphrases, expected);
    1.22  }
    1.23  
    1.24 @@ -47,8 +47,8 @@
    1.25      [self.cache addPassphrase:passphrase1];
    1.26      [self.cache addPassphrase:passphrase2];
    1.27  
    1.28 -    XCTAssertEqual(self.cache.passphrases.count, 3);
    1.29 -    NSArray *expected = @[@"", passphrase2, passphrase1];
    1.30 +    XCTAssertEqual(self.cache.passphrases.count, 2);
    1.31 +    NSArray *expected = @[passphrase2, passphrase1];
    1.32      XCTAssertEqualObjects(self.cache.passphrases, expected);
    1.33  }
    1.34  
    1.35 @@ -63,8 +63,7 @@
    1.36  
    1.37      NSMutableArray *expected = [NSMutableArray arrayWithArray:[self reversedArray:passphrases]];
    1.38  
    1.39 -    XCTAssertEqual(self.cache.passphrases.count, expected.count + 1);
    1.40 -    [expected insertObject:@"" atIndex:0];
    1.41 +    XCTAssertEqual(self.cache.passphrases.count, expected.count);
    1.42      XCTAssertEqualObjects(self.cache.passphrases, expected);
    1.43  }
    1.44  
    1.45 @@ -87,7 +86,6 @@
    1.46      // There are 21 passphrases, so the oldest (last) is removed.
    1.47      [expectedPassphrases removeLastObject];
    1.48  
    1.49 -    [expectedPassphrases insertObject:@"" atIndex:0];
    1.50      XCTAssertEqualObjects(self.cache.passphrases, expectedPassphrases);
    1.51  }
    1.52  
    1.53 @@ -101,11 +99,11 @@
    1.54      NSString *ownPassphrase = @"blah";
    1.55      [ownCache addPassphrase:ownPassphrase];
    1.56  
    1.57 -    NSArray *expectedBefore = @[@"", ownPassphrase];
    1.58 +    NSArray *expectedBefore = @[ownPassphrase];
    1.59      XCTAssertEqualObjects(ownCache.passphrases, expectedBefore);
    1.60  
    1.61      [NSThread sleepForTimeInterval:2*timeout];
    1.62 -    XCTAssertEqualObjects(ownCache.passphrases, @[@""]);
    1.63 +    XCTAssertEqualObjects(ownCache.passphrases, @[]);
    1.64  }
    1.65  
    1.66  - (void)testResetTimeout
    1.67 @@ -120,11 +118,11 @@
    1.68  
    1.69      [self.cache resetTimeoutForPassphrase:passphrase1];
    1.70  
    1.71 -    NSArray *expected1 = @[@"", passphrase1, passphrase3, passphrase2];
    1.72 +    NSArray *expected1 = @[passphrase1, passphrase3, passphrase2];
    1.73      XCTAssertEqualObjects(self.cache.passphrases, expected1);
    1.74  
    1.75      [self.cache resetTimeoutForPassphrase:passphrase3];
    1.76 -    NSArray *expected2 = @[@"", passphrase3, passphrase1, passphrase2];
    1.77 +    NSArray *expected2 = @[passphrase3, passphrase1, passphrase2];
    1.78      XCTAssertEqualObjects(self.cache.passphrases, expected2);
    1.79  }
    1.80