From 04b2d89fb6a0838788cf22db70800837524da367 Mon Sep 17 00:00:00 2001 From: michael starke Date: Mon, 9 Nov 2015 13:54:10 +0100 Subject: [PATCH] Added test databases (copied from KeePassKit) Signed-off-by: michael starke --- MacPass.xcodeproj/project.pbxproj | 36 ++++++++------ MacPassTests/Databases/Test_Password_1234.kdb | Bin 0 -> 732 bytes .../Databases/Test_Password_1234.kdbx | Bin 0 -> 1406 bytes MacPassTests/MPDatabaseLoading.m | 6 +-- MacPassTests/MPDatabasePasswordAndKeyfile.m | 47 ------------------ 5 files changed, 23 insertions(+), 66 deletions(-) create mode 100644 MacPassTests/Databases/Test_Password_1234.kdb create mode 100644 MacPassTests/Databases/Test_Password_1234.kdbx delete mode 100644 MacPassTests/MPDatabasePasswordAndKeyfile.m 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 0000000000000000000000000000000000000000..7f9c0ddbfbf45dbb612f63c874f74d887e54bb97 GIT binary patch literal 732 zcmV<20wetc*`k_d`%AS00000200RJ%!N5#@JIF?C9VB(qLvB(}RB6|cs;B2Z{=7$v zXysZ0000020002ZP$vmWaW(l+sz=W>y%_R@HrO2pfv*yt@>eiw$^*Snum&M&?C5ER zo8$@jKK#RI$?=TpI^GNdwfU)vO8-Jo!vFx&zMc$A;R@BaMq%RHT%s#1paD&|m}~;{ z*KwH}y8k?92dBjP6tZZN0cwHWB5)RqYFYH{^~dj-@8`uYBsbcxbFy8JtEd{ zpa+x=?0Oy)S4^vSLfkTT&2X+VU%j7u3`bi6R3KMEEdZRKmuzdn zO+!VPj*KfG@(WZivryqATQ3|K4vevl7%*->C&sMt0$&$$GdFy9bYX+qU z(YbBC;W+|W=U)tc1P;y1RZXpJ)k>+HB>e2uh6%yT? z`p-M9-w6i2GF*wFOl$WZRvt4ksN49AEc1#`?@wmx+l$$;*8|qq^JpR38LQ*=^_BTT z)~kImAiVSJxHy1yu2fvuUnd0VD4}(SC`n6tHkJ$6Ofw`8@c9wwOwD`BPPJ`|ey*GI O_B$2u3mh+O0aL`3#ARau literal 0 HcmV?d00001 diff --git a/MacPassTests/Databases/Test_Password_1234.kdbx b/MacPassTests/Databases/Test_Password_1234.kdbx new file mode 100644 index 0000000000000000000000000000000000000000..08fa7cdf8119e63b8ee0489f5f58c7788bcb6575 GIT binary patch literal 1406 zcmV-^1%dhl*`k_f`%AR}00RI55CAd3^5(yBLr}h01tDtuTK@wC0096100bZa7bRR- zHgvl?@Ek_=&V6F{8B}|h*w8|YUc{4@LO>rN1t0+Wno$UqMmUCmZ{x)kSM7u=QJUcr zLTq2_2*=J7nZVfw2mnyS00000000LN0E~@U@zVWuZ|Y!bOi3um*9ag0T@v*Q`V)%& zyI-vwj(Jamv_)b)9PHr z*N&B-+?pI6=ZLD;F09El>+DY~j+(sY9AP|icj?eTmj6UbD+9Em(Hl0txXJdk*~^(@ zAoi9$$5CQ!L34GFR3x;DZ>40GU;Q3&kSNsqypLsz13{(fwFB7lPSJlksZwz1-e{67=X>@W| z5ERh~qKP3n-Z=Bp{tQz&Fg{~Kq9yG4iLT@yQC+c7d}pU4itMhO-NM4?!U1`MIE3TN zv?pD}>^CqA?*)GwG5DEo=ErcRWD7Gh9_@QMtg@(4^`f;(hRpsSK;c_>q1tFMC!KnN zV*)#%f>2Df)v7YJv!eR9E5S9Ja$7$Oi+>(MIW^9H-Ql^a4&*kdoUVD+cL6>H6FE>t zC^*NWKH$2hXZ4pgYGC4G-OIgyjC&!l(Kf>lpy^V+GPk229t=8ap9sqg8404z6bajC z!Oasd;st*I3k?908zY@b0?=3YCD=ztZQxeE*9y}LOh!L~5p#)_RDC7;OU{O6O2Bj0 z0kQNu-~q{L&{5hyG9BQ0gWgx@2U@r#wLuVTDc;m-fW~lE??Y#WxzE$q8rPJ3g)&u> zeIXuVYo&n=!pPF$EJwOi1GQ7{p0+cz+h?%K7NzC#Ld`O5h{A??5?!V;qv#ByB7ATe z7!>?Y9(Zz$`9{v(EZd%pj~fpr2Z$ydxB)wMQ{Eol`M+Z+z$b$QMPaOS>tqTiZgL&# zM_8eDZWz%p6%)6-Ecbi4&Z;}2hLs;k>Fu5sHZGO@OX(mtk2@*^N!l$SFF;C4X7~vm zfUaWz)U`cV^FL6=ttKyvVeAayIYB;RncRMr|GrJ}R@%+-cQV;KMWU=hA))@War7k_ z{r*+y4x|Z`iBCRxiuMyDj)CO-O-%)R=LH@L zvdO6XNi_^4#+13Y0=)j&n|)9W8U&fp$U9`ZUm)A&4~s3@e&J`76dgO7xYB2?^sDsa z=F7%3R0!87(nC7i2{+74auzw+q1alRmM|}IgH~-RdM5lw{z(!XO)x*hE9iEy6sfe^ zn0-DN(hm@<=mvE?h?`!Na9}7f^J*d&Ad0JJrmlZhzEn6)-2_Orb`jK;m*9J&z$OZlvmE|V)nSh zFs~rku1Jq(4Nnm1ky`I-bsYNfWy7HJWVjwEI7z^8X)@*c^&@Z-yYwbPB@Vqg+Uz)y z4Qzc^V$h6ruPZEvbp~E0L^oZMt`rSkX^A};y}-bhS!5n(xa!Je9;@Rne2Q?pWGq4d z!NqgCymXYkLXTc8VAl}~&%*BgS`dV!g<_LF3gFi^H1;fu1_XwdO@yFo&>*i?`mtG% Mfjha6^*hdxUuu1kS^xk5 literal 0 HcmV?d00001 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