]> git.saurik.com Git - apple/security.git/blob - SecurityTests/regressions/t/40kc-unlock.t
Security-57031.1.35.tar.gz
[apple/security.git] / SecurityTests / regressions / t / 40kc-unlock.t
1 #!/usr/bin/perl -w
2
3 use strict;
4 use warnings;
5 BEGIN { require 't/security.pl' };
6 plan_security tests => 6;
7
8 $ENV{HOME}="/tmp/test$$";
9 ok(mkdir($ENV{HOME}), 'setup home');
10 is_output('security', 'create-keychain', [qw(-p test test-unlock)],
11 [],
12 'create kc');
13 TODO: {
14 local $TODO = "<rdar://problem/3835412> Unlocking an unlocked keychain with the wrong password succeeds";
15 is_output('security', 'unlock-keychain', ['-p', 'wrong', 'test-unlock'],
16 ['security: SecKeychainUnlock test-unlock: The user name or passphrase you entered is not correct.'],
17 'unlock unlocked kc w/ wrong pw');
18 };
19 is_output('security', 'lock-keychain', ['test-unlock'],
20 [],
21 'lock');
22 is_output('security', 'unlock-keychain', ['-p', 'wrong', 'test-unlock'],
23 ['security: SecKeychainUnlock test-unlock: The user name or passphrase you entered is not correct.'],
24 'unlock locked kc w/ wrong pw');
25 ok(system("rm -rf '$ENV{HOME}'") eq 0, 'cleanup home');
26
27 1;