diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index f5acdd93..b32ca3da 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -26,7 +26,6 @@ 4C17F105184E630200E85625 /* 14_BatteryTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C17F104184E630200E85625 /* 14_BatteryTemplate.pdf */; }; 4C17F108184E6B6C00E85625 /* 31_PrintTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C17F106184E6B6C00E85625 /* 31_PrintTemplate.pdf */; }; 4C17F109184E6B6C00E85625 /* 30_TerminalTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C17F107184E6B6C00E85625 /* 30_TerminalTemplate.pdf */; }; - 4C19E503178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C19E502178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.m */; }; 4C1DDCDD1711ECEB00C98DA3 /* PasswordCreatorWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C1DDCDC1711ECEB00C98DA3 /* PasswordCreatorWindow.xib */; }; 4C1E9885185F71A800943563 /* MPContextBarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1E9884185F71A800943563 /* MPContextBarViewController.m */; }; 4C1FA07B18231900003A3F8C /* MPDocument+Autotype.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1FA07A18231900003A3F8C /* MPDocument+Autotype.m */; }; @@ -202,6 +201,8 @@ 4CCA8E9B18D91ED9001A6754 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CCA8E9A18D91ED9001A6754 /* Quartz.framework */; }; 4CCEDE2A179F203B008402BE /* MPOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCEDE29179F203B008402BE /* MPOutlineView.m */; }; 4CCEDE2E179F213B008402BE /* MPNotifications.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCEDE2D179F213B008402BE /* MPNotifications.m */; }; + 4CCFA13D1BF0CC7A0078E0A1 /* Test_Password_1234.kdb in Resources */ = {isa = PBXBuildFile; fileRef = 4CCFA1321BF0CC7A0078E0A1 /* Test_Password_1234.kdb */; }; + 4CCFA13E1BF0CC7A0078E0A1 /* Test_Password_1234.kdbx in Resources */ = {isa = PBXBuildFile; fileRef = 4CCFA1331BF0CC7A0078E0A1 /* Test_Password_1234.kdbx */; }; 4CD2B9061849424B0051B395 /* MPAutotypeContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD2B9051849424B0051B395 /* MPAutotypeContext.m */; }; 4CD5D705177A5F3300100649 /* MPDatabaseSettingsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD5D704177A5F3300100649 /* MPDatabaseSettingsWindowController.m */; }; 4CD7223B17A7CB0700F5A1E1 /* MPWorkflowSettingsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD7223A17A7CB0700F5A1E1 /* MPWorkflowSettingsController.m */; }; @@ -382,7 +383,6 @@ 4C17F104184E630200E85625 /* 14_BatteryTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 14_BatteryTemplate.pdf; sourceTree = ""; }; 4C17F106184E6B6C00E85625 /* 31_PrintTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 31_PrintTemplate.pdf; sourceTree = ""; }; 4C17F107184E6B6C00E85625 /* 30_TerminalTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 30_TerminalTemplate.pdf; sourceTree = ""; }; - 4C19E502178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPDatabasePasswordAndKeyfile.m; sourceTree = ""; }; 4C1DDCDC1711ECEB00C98DA3 /* PasswordCreatorWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PasswordCreatorWindow.xib; sourceTree = ""; }; 4C1E9883185F71A800943563 /* MPContextBarViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPContextBarViewController.h; sourceTree = ""; }; 4C1E9884185F71A800943563 /* MPContextBarViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPContextBarViewController.m; sourceTree = ""; }; @@ -665,6 +665,8 @@ 4CCEDE29179F203B008402BE /* MPOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOutlineView.m; sourceTree = ""; }; 4CCEDE2C179F2122008402BE /* MPNotifications.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPNotifications.h; sourceTree = ""; }; 4CCEDE2D179F213B008402BE /* MPNotifications.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPNotifications.m; sourceTree = ""; }; + 4CCFA1321BF0CC7A0078E0A1 /* Test_Password_1234.kdb */ = {isa = PBXFileReference; lastKnownFileType = file; path = Test_Password_1234.kdb; sourceTree = ""; }; + 4CCFA1331BF0CC7A0078E0A1 /* Test_Password_1234.kdbx */ = {isa = PBXFileReference; lastKnownFileType = file; path = Test_Password_1234.kdbx; sourceTree = ""; }; 4CD2B9041849424B0051B395 /* MPAutotypeContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAutotypeContext.h; sourceTree = ""; }; 4CD2B9051849424B0051B395 /* MPAutotypeContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPAutotypeContext.m; sourceTree = ""; }; 4CD5D703177A5F3300100649 /* MPDatabaseSettingsWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDatabaseSettingsWindowController.h; sourceTree = ""; }; @@ -1027,7 +1029,11 @@ 4C45FB1E178E09ED0010007D /* MacPassTests */ = { isa = PBXGroup; children = ( - 4C4B6E3C1B5E24870082EEF2 /* MacPass */, + 4CCFA12C1BF0CC7A0078E0A1 /* Databases */, + 4C10207E1B750E2F00BFCD59 /* MPTestAutotype.m */, + 4C45FB2C178E0BCB0010007D /* MPDatabaseLoading.m */, + 4C45FB2F178E0CE20010007D /* MPTestDocument.m */, + 4C6BC65F1A36717E00BDDF3D /* MPDatabaseSearch.m */, 4C45FB1F178E09ED0010007D /* Supporting Files */, ); path = MacPassTests; @@ -1058,18 +1064,6 @@ name = Settings; sourceTree = ""; }; - 4C4B6E3C1B5E24870082EEF2 /* MacPass */ = { - isa = PBXGroup; - children = ( - 4C10207E1B750E2F00BFCD59 /* MPTestAutotype.m */, - 4C45FB2C178E0BCB0010007D /* MPDatabaseLoading.m */, - 4C45FB2F178E0CE20010007D /* MPTestDocument.m */, - 4C19E502178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.m */, - 4C6BC65F1A36717E00BDDF3D /* MPDatabaseSearch.m */, - ); - name = MacPass; - sourceTree = ""; - }; 4C4B7EF517A46815000234C7 /* Inspector */ = { isa = PBXGroup; children = ( @@ -1365,6 +1359,15 @@ name = Products; sourceTree = ""; }; + 4CCFA12C1BF0CC7A0078E0A1 /* Databases */ = { + isa = PBXGroup; + children = ( + 4CCFA1321BF0CC7A0078E0A1 /* Test_Password_1234.kdb */, + 4CCFA1331BF0CC7A0078E0A1 /* Test_Password_1234.kdbx */, + ); + path = Databases; + sourceTree = ""; + }; 4CDB556616E29A8A00635918 /* Controls */ = { isa = PBXGroup; children = ( @@ -1631,6 +1634,8 @@ buildActionMask = 2147483647; files = ( 4C45FB23178E09ED0010007D /* InfoPlist.strings in Resources */, + 4CCFA13E1BF0CC7A0078E0A1 /* Test_Password_1234.kdbx in Resources */, + 4CCFA13D1BF0CC7A0078E0A1 /* Test_Password_1234.kdb in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1778,7 +1783,6 @@ files = ( 4C45FB2D178E0BCB0010007D /* MPDatabaseLoading.m in Sources */, 4C45FB30178E0CE20010007D /* MPTestDocument.m in Sources */, - 4C19E503178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.m in Sources */, 4C6BC6601A36717E00BDDF3D /* MPDatabaseSearch.m in Sources */, 4C10207F1B750E2F00BFCD59 /* MPTestAutotype.m in Sources */, ); diff --git a/MacPassTests/Databases/Test_Password_1234.kdb b/MacPassTests/Databases/Test_Password_1234.kdb new file mode 100644 index 00000000..7f9c0ddb Binary files /dev/null and b/MacPassTests/Databases/Test_Password_1234.kdb differ diff --git a/MacPassTests/Databases/Test_Password_1234.kdbx b/MacPassTests/Databases/Test_Password_1234.kdbx new file mode 100644 index 00000000..08fa7cdf Binary files /dev/null and b/MacPassTests/Databases/Test_Password_1234.kdbx differ diff --git a/MacPassTests/MPDatabaseLoading.m b/MacPassTests/MPDatabaseLoading.m index 826b348d..0e060040 100644 --- a/MacPassTests/MPDatabaseLoading.m +++ b/MacPassTests/MPDatabaseLoading.m @@ -19,7 +19,7 @@ - (void)testLoadVersion1 { - NSBundle *myBundle = [NSBundle bundleForClass:[KPKTree class]]; + NSBundle *myBundle = [NSBundle bundleForClass:[self class]]; NSURL *url = [myBundle URLForResource:@"Test_Password_1234" withExtension:@"kdb"]; NSError *error = nil; MPDocument *document = [[MPDocument alloc] initWithContentsOfURL:url ofType:@"kdb" error:&error]; @@ -33,7 +33,7 @@ } - (void)testVersion1WrongPassword { - NSBundle *myBundle = [NSBundle bundleForClass:[KPKTree class]]; + NSBundle *myBundle = [NSBundle bundleForClass:[self class]]; NSURL *url = [myBundle URLForResource:@"Test_Password_1234" withExtension:@"kdb"]; NSError *error = nil; MPDocument *document = [[MPDocument alloc] initWithContentsOfURL:url ofType:@"kdb" error:&error]; @@ -45,7 +45,7 @@ } - (void)testLoadDatabaseVerions2 { - NSBundle *myBundle = [NSBundle bundleForClass:[KPKTree class]]; + NSBundle *myBundle = [NSBundle bundleForClass:[self class]]; NSURL *url = [myBundle URLForResource:@"Test_Password_1234" withExtension:@"kdbx"]; NSError *error = nil; MPDocument *document = [[MPDocument alloc] initWithContentsOfURL:url ofType:@"kdbx" error:&error]; diff --git a/MacPassTests/MPDatabasePasswordAndKeyfile.m b/MacPassTests/MPDatabasePasswordAndKeyfile.m deleted file mode 100644 index f36f3a43..00000000 --- a/MacPassTests/MPDatabasePasswordAndKeyfile.m +++ /dev/null @@ -1,47 +0,0 @@ -// -// MPDatabasePasswordAndKeyfile.m -// MacPass -// -// Created by Michael Starke on 11.07.13. -// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. -// - - -#import - -#import "MPDocument.h" -#import "KeePassKit/KeePassKit.h" - -@interface MPDatabasePasswordAndKeyfile : XCTestCase { - MPDocument *_database; -} -@end - -@implementation MPDatabasePasswordAndKeyfile - -- (void)setUp { - _database = [[MPDocument alloc] init]; -} - -- (void)tearDown { - _database = nil; -} - -- (void)testSetPassword { - XCTAssertNil(_database.compositeKey, @"New database should not have a composite key"); - XCTAssertTrue([_database changePassword:@"password" keyFileURL:nil], @"Setting the Password should succeed"); - XCTAssertFalse([_database changePassword:nil keyFileURL:nil], @"resetting the password and key to nil should not work"); -} - -- (void)testSetKeyfile {/* - STAssertTrue([_database.password length] == 0, @"Password should not be set"); - STAssertNil(_database.key, @"Keyfile should not be set"); - STAssertFalse(_database.hasPasswordOrKey, @"Database without keyfile is not secure"); - _database.key = [NSURL URLWithString:@"noKeyFile"]; - STAssertTrue(_database.hasPasswordOrKey, @"Database with keyfile is secured"); - _database.key = nil; - STAssertFalse(_database.hasPasswordOrKey, @"Database with removed keyfile is not secure anymore");*/ -} - - -@end