summaryrefslogtreecommitdiffstats
path: root/t/superuser--addmedia.t
blob: d8e31ad31478e0977dc5c67f73d8920645c0aab8 (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
#!/usr/bin/perl

use strict;
use lib '.', 't';
use helper;
use Test::More 'no_plan';
BEGIN { use_ok 'urpm::cfg' }

need_root_and_prepare();

my $name = 'various';

try('', { hdlist => undef, synthesis => undef });
try('--probe-hdlist', { hdlist => "hdlist.$name.cz", synthesis => undef });
try('--probe-synthesis', { hdlist => undef, synthesis => 1 });

sub try {
    my ($options, $want) = @_;
    urpmi_addmedia("$name $::pwd/media/$name $options");
    my $config = urpm::cfg::load_config("root/etc/urpmi/urpmi.cfg");
    my ($medium) = @{$config->{media}};
    ok($medium);
    foreach my $field (keys %$want) {
	is($medium->{$field}, $want->{$field});
    }
    urpmi_removemedia($name);
}