Files
MacPass/MacPassTests/KPKTestPlaceholder.m
michael starke 5661765dbf Added Autotype layout to entry view.
Fixed ARC bug in placeholder evaluation
2014-02-12 22:17:34 +01:00

35 lines
1.1 KiB
Objective-C

//
// KPKTextPlaceholder.m
// MacPass
//
// Created by Michael Starke on 15.08.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "KPKTestPlaceholder.h"
#import "KPKEntry.h"
#import "KPKAttribute.h"
#import "NSString+Commands.h"
@implementation KPKTextPlaceholder
- (void)testPlaceholder {
KPKEntry *entry = [[KPKEntry alloc] init];
entry.title = @"TestTitle";
entry.username = @"TestUsername";
entry.notes = @"TestNotes";
entry.url = @"TestURL";
entry.password = @"TestPassword";
KPKAttribute *attribute = [[KPKAttribute alloc] initWithKey:@"extended" value:@"valueForExtended"];
[entry addCustomAttribute:attribute];
NSString *placeholder = @"{USERNAME}{PASSWORD}{NOTHING}{URL}{S:extended}";
BOOL replaced;
NSString *evaluated = [placeholder evaluatePlaceholderWithEntry:entry didReplace:&replaced];
//NSString *evaluatedGoal = [NSString stringWithFormat:@"%@%@{NOTHING}%@%@", entry.username, entry.password, entry.url, attribute.value];
//STAssertTrue([evaluated isEqualToString:evaluatedGoal], @"Evaluated string must match");
}
@end