Migrated project to XCTest

This commit is contained in:
michael starke
2014-02-15 18:35:56 +01:00
parent edd2d89d30
commit 1f1c6d5dcb
22 changed files with 228 additions and 359 deletions

View File

@@ -6,11 +6,15 @@
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "KPKTestLegacyWriting.h"
#import <XCTest/XCTest.h>
#import "KPKCompositeKey.h"
#import "KPKTree+Serializing.h"
@interface KPKTestLegacyWriting : XCTestCase
@end
@implementation KPKTestLegacyWriting
- (void)testWriting {
@@ -18,15 +22,15 @@
NSURL *dbUrl = [self _urlForFile:@"CustomIcon_Password_1234" extension:@"kdbx"];
KPKCompositeKey *password = [[KPKCompositeKey alloc] initWithPassword:@"1234" key:nil];
KPKTree *tree = [[KPKTree alloc] initWithContentsOfUrl:dbUrl password:password error:&error];
STAssertNotNil(tree, @"Tree should be created");
XCTAssertNotNil(tree, @"Tree should be created");
error = nil;
NSData *data = [tree encryptWithPassword:password forVersion:KPKLegacyVersion error:&error];
STAssertNotNil(data, @"Serialized Data shoudl be created");
XCTAssertNotNil(data, @"Serialized Data shoudl be created");
NSString *tempFile = [NSTemporaryDirectory() stringByAppendingString:@"CustomIcon_Password_1234.kdb"];
NSLog(@"Saved to %@", tempFile);
[data writeToFile:tempFile atomically:YES];
KPKTree *loadTree = [[KPKTree alloc] initWithData:data password:password error:&error];
STAssertNotNil(loadTree, @"Tree should be loadable from kdb file data");
XCTAssertNotNil(loadTree, @"Tree should be loadable from kdb file data");
}
- (NSData *)_dataForFile:(NSString *)name extension:(NSString *)extension {