aboutsummaryrefslogtreecommitdiffstats
path: root/t/sign.t
blob: db6f619bdc76484d2a644fda6ea4550a11320045 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl
# $Id: sign.t 1407 2006-12-03 12:02:02Z guillomovitch $

use Test::More tests => 3;
use Test::Exception;
use File::Basename;
use Youri::Package::RPM::Generator;
use Youri::Package::RPM::URPM;
use Youri::Submit::Action::Sign;

my $action1 = Youri::Submit::Action::Sign->new(
    name       => 'Youri',
    path       => dirname($0) . '/gpghome',
    passphrase => 'Youri sux',
    skip       => [ 'cheater' ]
);

dies_ok {
    $action1->run(
        Youri::Package::RPM::URPM->new(
            file => Youri::Package::RPM::Generator->new()->get_source(),
        ),
        undef,
        undef,
        undef
    )
} 'signing with wrong key';

lives_ok {
    $action1->run(
        Youri::Package::RPM::URPM->new(
            file => Youri::Package::RPM::Generator->new(tags => {
                name => 'cheater',
            })->get_source(),
        ),
        undef,
        undef,
        undef
    )
} 'signing with wrong key using an exception';

my $action2 = Youri::Submit::Action::Sign->new(
    name       => 'Youri',
    path       => dirname($0) . '/gpghome',
    passphrase => 'Youri rulez',
);

lives_ok {
    $action2->run(
        Youri::Package::RPM::URPM->new(
            file => Youri::Package::RPM::Generator->new()->get_source(),
        ),
        undef,
        undef,
        undef
    )
} 'signing with correct key';