Using new KeePassKit API (not building!)

Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
michael starke
2015-10-27 18:36:41 +01:00
parent 6031ba021a
commit 2f7169523e
7 changed files with 71 additions and 35 deletions

View File

@@ -0,0 +1,53 @@
//
// KPKTestModificationDates.m
// MacPass
//
// Created by Michael Starke on 26/10/15.
// Copyright © 2015 HicknHack Software GmbH. All rights reserved.
//
#import <XCTest/XCTest.h>
#import "KeePassKit.h"
#import "KPKEntry+Private.h"
@interface KPKTestModificationDates : XCTestCase
@property (strong) KPKTree *tree;
@property (weak) KPKGroup *group;
@property (weak) KPKEntry *entry;
@end
@implementation KPKTestModificationDates
- (void)setUp {
[super setUp];
self.tree = [[KPKTree alloc] init];
self.tree.root = [[KPKGroup alloc] init];
self.group = self.tree.root;
[self.group addEntry:[[KPKEntry alloc] init]];
self.entry = self.group.entries.firstObject;
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testGroupModificationDate {
}
- (void)testEntryModifiationDate {
static NSString *const _kUpdatedString = @"Updated";
for(NSString *key in [KPKFormat sharedFormat].entryDefaultKeys) {
NSDate *before = [self.entry.timeInfo.modificationDate copy];
[self.entry _setValue:_kUpdatedString forAttributeWithKey:key];
NSComparisonResult compare = [before compare:self.entry.timeInfo.modificationDate];
XCTAssertTrue(compare == NSOrderedAscending,@"Modification date has to be updated after modification");
}
}
@end