mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 17:32:17 +00:00
Using new KeePassKit API (not building!)
Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
53
MacPassTests/KPKTestModificationDates.m
Normal file
53
MacPassTests/KPKTestModificationDates.m
Normal 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
|
||||
Reference in New Issue
Block a user