mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 16:22:21 +00:00
Experiments with globe hot-key via EventTaps instead of Carbon API
Drag and Drop of entries and groups reworked Minor fixes in Tests
This commit is contained in:
34
MacPassTests/KPKTestPlaceholder.m
Normal file
34
MacPassTests/KPKTestPlaceholder.m
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// 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+Placeholder.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
|
||||
Reference in New Issue
Block a user