Unit tests for SFTP protocol
Closed this issue · 3 comments
samdeane commented
Need some tests for the CK2 SFTP implementation
mikeabdullah commented
I have some tests uncommitted that run against my local SSH server. The question is, how to avoid checking in your password as part of that?
samdeane commented
The way I usually do it is to read the password from NSUserDefaults.
If the value is missing, assert with an error telling the user to run defaults write otest CK2SFTPTestPassword <pass>"
from the command-line to set the password.
E.g, from CURLProtocolTests:
NSString* ftpTest = [[NSUserDefaults standardUserDefaults] objectForKey:@"CURLHandleTestsFTPServer"];
STAssertNotNil(ftpTest, @"need to set a test server address using defaults, e.g: defaults write otest CURLHandleTestsFTPServer \"ftp://user:password@ftp.test.com\"");
samdeane commented
Alternatively, it might be possible to run another instance of sshd on a custom port as a normal user, then have the test use that. The first answer is probably easier though :)