[Keychain-commit] SF.net SVN: keychain: [441] trunk/Frameworks/Keychain/Testers/ KeychainTester.m
Status: Abandoned
Brought to you by:
wadetregaskis
|
From: <wad...@us...> - 2007-12-09 22:02:54
|
Revision: 441
http://keychain.svn.sourceforge.net/keychain/?rev=441&view=rev
Author: wadetregaskis
Date: 2007-12-09 14:02:58 -0800 (Sun, 09 Dec 2007)
Log Message:
-----------
* Added test for adding an invalid (nil == password) SSH KeychainItem.
Modified Paths:
--------------
trunk/Frameworks/Keychain/Testers/KeychainTester.m
Modified: trunk/Frameworks/Keychain/Testers/KeychainTester.m
===================================================================
--- trunk/Frameworks/Keychain/Testers/KeychainTester.m 2007-12-09 22:01:24 UTC (rev 440)
+++ trunk/Frameworks/Keychain/Testers/KeychainTester.m 2007-12-09 22:02:58 UTC (rev 441)
@@ -203,7 +203,53 @@
TEST_ISEQUAL([currentItem dataAsString], @"overwritten", "\tOriginal item's password reflects the change");
}
+ originalItem = currentItem = [testKeychain addInternetPassword:nil onServer:@"www.widget.com" forAccount:@"root" port:22 path:nil inSecurityDomain:nil protocol:kSecProtocolTypeSSH auth:kSecAuthenticationTypeDefault replaceExisting:NO];
+ TEST(nil != currentItem, "Can create SSH keychain item without password");
+ if (nil != currentItem) {
+ TEST_ISNIL([currentItem dataAsString], "\tPassword is (correctly) not available");
+
+ TEST_ISEQUAL([currentItem account], @"root", "\tAccount is correct");
+ TEST_ISEQUAL([currentItem securityDomain], @"", "\tSecurity domain is correct (none)");
+ TEST_ISEQUAL([currentItem server], @"www.widget.com", "\tServer is correct");
+ TEST_INTSEQUAL_F([currentItem authenticationType], kSecAuthenticationTypeDefault, nameOfAuthenticationTypeConstant, "\tAuthentication type is correct");
+ TEST_INTSEQUAL([currentItem port], 22, "\tPort is correct");
+ TEST_ISEQUAL([currentItem path], @"", "\tPath is correct");
+ TEST_INTSEQUAL_F([currentItem protocol], kSecProtocolTypeSSH, nameOfProtocolConstant, "\tProtocol is correct");
+
+ TEST(![currentItem passwordIsValid], "\tPassword is noted as invalid");
+ TEST(![currentItem isVisible], "\tPassword is invisible");
+ TEST(![currentItem hasCustomIcon], "\tDoesn't have custom icon");
+
+ NSDate *creationDate = [currentItem creationDate];
+ TEST_COMPARE_DATES_WITHOUT_SUBSECONDS(creationDate, >=, testStart, "\tCreation date is the same time as or after this test started");
+ TEST_COMPARE_DATES_WITHOUT_SUBSECONDS(creationDate, <=, [NSDate date], "\tCreation date is the same time as or earlier than right now");
+
+ NSDate *modificationDate = [currentItem creationDate];
+ TEST_COMPARE_DATES_WITHOUT_SUBSECONDS(modificationDate, >=, testStart, "\tModification date is the same time as or after this test started");
+ TEST_COMPARE_DATES_WITHOUT_SUBSECONDS(modificationDate, <=, [NSDate date], "\tModification date is the same time as or earlier than right now");
+
+ TEST_ISEQUAL([currentItem typeDescription], @"", "\tHas no type description");
+ TEST_ISEQUAL([currentItem comment], @"", "\tHas no comment");
+ TEST_INTSEQUAL([currentItem creator], 0, "\tHas no creator (FourCharCode version)");
+ TEST_ISEQUAL([currentItem creatorAsString], @"", "\tHas no creator (string version)");
+ TEST_INTSEQUAL([currentItem type], 0, "\tHas no type (FourCharCode version)");
+ TEST_ISEQUAL([currentItem typeAsString], @"", "\tHas no type (string version)");
+ //TEST_ISEQUAL([currentItem label], @"", "\tHas no label"); // A label is set by default ("localhost", in this example, at present), which is valid.. but I don't want to test against it explicitly, because really any default is valid.
+ TEST_ISEQUAL([currentItem alias], @"", "\tHas no alias");
+
+ TEST_ISNIL([currentItem service], "\tDoesn't have a service (not applicable to interest passwords)");
+ TEST_ISNIL([currentItem userDefinedAttribute], "\tDoesn't have user-defined attribute (not applicable to internet passwords)");
+ TEST_ISNIL([currentItem appleShareVolume], "\tDoesn't have AppleShare volume (not applicable to internet passwords)");
+ TEST_ISNIL([currentItem appleShareAddress], "\tDoesn't have AppleShare address (not applicable to internet passwords)");
+ TEST_ISNIL([currentItem appleShareSignatureData], "\tDoesn't have AppleShare signature (not applicable to internet passwords)");
+ TEST_INTSEQUAL_F([currentItem certificateType], CSSM_CERT_UNKNOWN, nameOfCertificateTypeConstant, "\tDoesn't have a certificate type (not applicable to internet passwords)");
+ TEST_INTSEQUAL_F([currentItem certificateEncoding], CSSM_CERT_ENCODING_UNKNOWN, nameOfCertificateEncodingConstant, "\tDoesn't have a certificate encoding (not applicable to internet passwords)");
+ TEST_INTSEQUAL_F([currentItem CRLType], CSSM_CRL_TYPE_UNKNOWN, nameOfCRLTypeConstant, "\tDoesn't have a CRL type (not applicable to internet passwords)");
+ TEST_INTSEQUAL_F([currentItem CRLEncoding], CSSM_CRL_ENCODING_UNKNOWN, nameOfCRLEncodingConstant, "\tDoesn't have a CRL encoding (not applicable to internet passwords)");
+ }
+
+
#pragma mark -- Chinese Internet password
NSString *chinesePassword = [NSString stringWithUTF8String:"我姓王"];
@@ -353,7 +399,7 @@
[currentItem setIsVisible:NO];
TEST(![currentItem isVisible], "\tCan change visibility");
- [currentItem setIsValid:NO];
+ [currentItem setPasswordIsValid:NO];
TEST(![currentItem passwordIsValid], "\tCan change password validity");
[currentItem setHasCustomIcon:YES];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|