From 6eef7bc0b00f1e76542cc9ce86c0fd66b1e3f567 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 4 Dec 2006 11:23:18 +0000 Subject: add tests for --probe-synthesis/--probe-hdlist --- t/superuser--addmedia.t | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 t/superuser--addmedia.t (limited to 't') diff --git a/t/superuser--addmedia.t b/t/superuser--addmedia.t new file mode 100644 index 00000000..d8e31ad3 --- /dev/null +++ b/t/superuser--addmedia.t @@ -0,0 +1,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); +} -- cgit v1.2.1