mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 00:02:28 +00:00
Updated KeePassKit submodule
Added save to Kdbx test
This commit is contained in:
13
MacPassTests/KPKTestXmlWriting.h
Normal file
13
MacPassTests/KPKTestXmlWriting.h
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// KPKTestXmlWriting.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 20.08.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
|
||||
@interface KPKTestXmlWriting : SenTestCase
|
||||
|
||||
@end
|
||||
31
MacPassTests/KPKTestXmlWriting.m
Normal file
31
MacPassTests/KPKTestXmlWriting.m
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// KPKTestXmlWriting.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 20.08.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "KPKTestXmlWriting.h"
|
||||
#import "KPKPassword.h"
|
||||
#import "KPKTree+Serializing.h"
|
||||
|
||||
@implementation KPKTestXmlWriting
|
||||
|
||||
- (void)testXmlWriting {
|
||||
NSData *data = [self _loadTestDataBase:@"CustomIcon_Password_1234" extension:@"kdbx"];
|
||||
NSError *error;
|
||||
KPKPassword *password = [[KPKPassword alloc] initWithPassword:@"1234" key:nil];
|
||||
KPKTree *tree = [[KPKTree alloc] initWithData:data password:password error:&error];
|
||||
error = nil;
|
||||
NSData *saveData = [tree encryptWithPassword:password forVersion:KPKXmlVersion error:&error];
|
||||
//[saveData writeToFile:@"CustomIcon_Password_1234_save.kdbx" atomically:YES];
|
||||
}
|
||||
|
||||
- (NSData *)_loadTestDataBase:(NSString *)name extension:(NSString *)extension {
|
||||
NSBundle *myBundle = [NSBundle bundleForClass:[self class]];
|
||||
NSURL *url = [myBundle URLForResource:name withExtension:extension];
|
||||
return [NSData dataWithContentsOfURL:url];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user