diff options
-rw-r--r-- | t/superuser--addmedia.t | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/t/superuser--addmedia.t b/t/superuser--addmedia.t index 2a2f1dfe..6080063b 100644 --- a/t/superuser--addmedia.t +++ b/t/superuser--addmedia.t @@ -10,26 +10,36 @@ need_root_and_prepare(); my $name = 'various'; -my @fields = qw(hdlist synthesis with_hdlist media_info_dir); -try('', { media_info_dir => 'media_info' }); +my @fields = qw(hdlist synthesis with_hdlist media_info_dir virtual); -try('--probe-hdlist', - { hdlist => "hdlist.$name.cz", media_info_dir => 'media_info' }); -try('with media_info/hdlist.cz', - { hdlist => "hdlist.$name.cz", media_info_dir => 'media_info' }); -try("with ../media_info/hdlist_$name.cz", - { hdlist => "hdlist.$name.cz", with_hdlist => "../media_info/hdlist_$name.cz" }); +try_medium('', { media_info_dir => 'media_info' }); -try('--probe-synthesis', +try_medium('--probe-hdlist', + { hdlist => 1, media_info_dir => 'media_info' }); +try_medium('with media_info/hdlist.cz', + { hdlist => 1, media_info_dir => 'media_info' }); +try_medium("with ../media_info/hdlist_$name.cz", + { hdlist => 1, with_hdlist => "../media_info/hdlist_$name.cz" }); + +try_medium('--probe-synthesis', { synthesis => 1, media_info_dir => 'media_info' }); -try('with media_info/synthesis.hdlist.cz', +try_medium('with media_info/synthesis.hdlist.cz', { synthesis => 1, media_info_dir => 'media_info' }); -try("with ../media_info/synthesis.hdlist_$name.cz", +try_medium("with ../media_info/synthesis.hdlist_$name.cz", { synthesis => 1, with_hdlist => "../media_info/synthesis.hdlist_$name.cz" }); -sub try { +sub try_medium { my ($options, $want) = @_; urpmi_addmedia("$name $::pwd/media/$name $options"); + try_($want); + urpmi_removemedia($name); + urpmi_addmedia("$name $::pwd/media/$name --virtual $options"); + try_({ virtual => 1, %$want }); + urpmi_removemedia($name); +} + +sub try_ { + my ($want) = @_; my $config = urpm::cfg::load_config("root/etc/urpmi/urpmi.cfg"); my ($medium) = @{$config->{media}}; ok($medium); @@ -39,5 +49,4 @@ sub try { urpmi($name); is(`rpm -qa --root $::pwd/root`, "$name-1-1\n"); urpme($name); - urpmi_removemedia($name); } |