]> git.saurik.com Git - apple/security.git/blame - SecurityTests/regressions/t/40kc-unlock.t
Security-57337.40.85.tar.gz
[apple/security.git] / SecurityTests / regressions / t / 40kc-unlock.t
CommitLineData
d8f41ccd
A
1#!/usr/bin/perl -w
2
3use strict;
4use warnings;
5BEGIN { require 't/security.pl' };
6plan_security tests => 6;
7
8$ENV{HOME}="/tmp/test$$";
9ok(mkdir($ENV{HOME}), 'setup home');
10is_output('security', 'create-keychain', [qw(-p test test-unlock)],
11 [],
12 'create kc');
13TODO: {
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};
19is_output('security', 'lock-keychain', ['test-unlock'],
20 [],
21 'lock');
22is_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');
25ok(system("rm -rf '$ENV{HOME}'") eq 0, 'cleanup home');
26
271;