diff --git a/KeePassKit b/KeePassKit index fcee646a..1ccbacd7 160000 --- a/KeePassKit +++ b/KeePassKit @@ -1 +1 @@ -Subproject commit fcee646a0797637a63af0161505bb62283083649 +Subproject commit 1ccbacd760a94a1e7989229b767a601ce24a9a56 diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index 2ab6a617..e974866b 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -185,6 +185,7 @@ 4C6D1D25178579570014C5A5 /* 48_FolderTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C6D1D24178579570014C5A5 /* 48_FolderTemplate.pdf */; }; 4C6D1D27178586CA0014C5A5 /* 99_AddFolderTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C6D1D26178586CA0014C5A5 /* 99_AddFolderTemplate.pdf */; }; 4C6D1D2B17858A250014C5A5 /* MacPass.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4C6D1D2A17858A250014C5A5 /* MacPass.icns */; }; + 4C6FDD2117BC4F4C004AEEC8 /* KPKTextPlaceholder.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6FDD2017BC4F4C004AEEC8 /* KPKTextPlaceholder.m */; }; 4C701CBC178618A000581B88 /* 12_RemoteTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C701CBB178618A000581B88 /* 12_RemoteTemplate.pdf */; }; 4C70D100179092F200652EE9 /* KPKPassword.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C70D0FF179092F200652EE9 /* KPKPassword.m */; }; 4C74DD07177BD1640034A9DB /* MPCustomFieldView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C74DD06177BD1640034A9DB /* MPCustomFieldView.m */; }; @@ -635,6 +636,8 @@ 4C6D1D24178579570014C5A5 /* 48_FolderTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 48_FolderTemplate.pdf; sourceTree = ""; }; 4C6D1D26178586CA0014C5A5 /* 99_AddFolderTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = 99_AddFolderTemplate.pdf; path = Icons/99_AddFolderTemplate.pdf; sourceTree = ""; }; 4C6D1D2A17858A250014C5A5 /* MacPass.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = MacPass.icns; path = "../Assets/App icon/MacPass.icns"; sourceTree = ""; }; + 4C6FDD1F17BC4F4C004AEEC8 /* KPKTextPlaceholder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKTextPlaceholder.h; sourceTree = ""; }; + 4C6FDD2017BC4F4C004AEEC8 /* KPKTextPlaceholder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTextPlaceholder.m; sourceTree = ""; }; 4C701CBB178618A000581B88 /* 12_RemoteTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 12_RemoteTemplate.pdf; sourceTree = ""; }; 4C70D0FE179092F200652EE9 /* KPKPassword.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKPassword.h; sourceTree = ""; }; 4C70D0FF179092F200652EE9 /* KPKPassword.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = KPKPassword.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; @@ -1273,6 +1276,8 @@ 4CE76DAC17B3AD010043B82B /* KPKHashedDataTest.m */, 4CEAF85917BA9B44001307A6 /* KPKTestKeyfileParsing.h */, 4CEAF85A17BA9B44001307A6 /* KPKTestKeyfileParsing.m */, + 4C6FDD1F17BC4F4C004AEEC8 /* KPKTextPlaceholder.h */, + 4C6FDD2017BC4F4C004AEEC8 /* KPKTextPlaceholder.m */, ); path = MacPassTests; sourceTree = ""; @@ -2024,6 +2029,7 @@ 4C6366AF17AF207600AAF17D /* KPKTestHexColor.m in Sources */, 4CE76DAD17B3AD010043B82B /* KPKHashedDataTest.m in Sources */, 4CEAF85B17BA9B44001307A6 /* KPKTestKeyfileParsing.m in Sources */, + 4C6FDD2117BC4F4C004AEEC8 /* KPKTextPlaceholder.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MacPassTests/KPKTextPlaceholder.h b/MacPassTests/KPKTextPlaceholder.h new file mode 100644 index 00000000..94591d0f --- /dev/null +++ b/MacPassTests/KPKTextPlaceholder.h @@ -0,0 +1,13 @@ +// +// KPKTextPlaceholder.h +// MacPass +// +// Created by Michael Starke on 15.08.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import + +@interface KPKTextPlaceholder : SenTestCase + +@end diff --git a/MacPassTests/KPKTextPlaceholder.m b/MacPassTests/KPKTextPlaceholder.m new file mode 100644 index 00000000..0f234a64 --- /dev/null +++ b/MacPassTests/KPKTextPlaceholder.m @@ -0,0 +1,33 @@ +// +// KPKTextPlaceholder.m +// MacPass +// +// Created by Michael Starke on 15.08.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "KPKTextPlaceholder.h" +#import "KPKEntry.h" +#import "KPKAttribute.h" + +#import "NSString+CommandString.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}"; + NSString *evaluated = [placeholder evaluatePlaceholderWithEntry:entry]; + NSString *evaluatedGoal = [NSString stringWithFormat:@"%@%@{NOTHING}%@%@", entry.username, entry.password, entry.url, attribute.value]; + STAssertTrue([evaluated isEqualToString:evaluatedGoal], @"Evaluated string must match"); +} + +@end