summaryrefslogtreecommitdiffstats
path: root/t/superuser--urpmi_update.t
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-11-14 15:32:36 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-11-14 15:32:36 +0000
commit1f1f3ab742b39d3aa5b67a545cc924b78ec8279e (patch)
treeacee4949454e5321643f8f836dcf65c3285468f1 /t/superuser--urpmi_update.t
parent830d5819dd6280d8133342d700a26b4f6ee9ec56 (diff)
downloadurpmi-1f1f3ab742b39d3aa5b67a545cc924b78ec8279e.tar
urpmi-1f1f3ab742b39d3aa5b67a545cc924b78ec8279e.tar.gz
urpmi-1f1f3ab742b39d3aa5b67a545cc924b78ec8279e.tar.bz2
urpmi-1f1f3ab742b39d3aa5b67a545cc924b78ec8279e.tar.xz
urpmi-1f1f3ab742b39d3aa5b67a545cc924b78ec8279e.zip
add a testcase for #45457
Diffstat (limited to 't/superuser--urpmi_update.t')
-rw-r--r--t/superuser--urpmi_update.t65
1 files changed, 65 insertions, 0 deletions
diff --git a/t/superuser--urpmi_update.t b/t/superuser--urpmi_update.t
new file mode 100644
index 00000000..475fb31c
--- /dev/null
+++ b/t/superuser--urpmi_update.t
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+
+use strict;
+use lib '.', 't';
+use helper;
+use Test::More 'no_plan';
+BEGIN { use_ok 'urpm::cfg' }
+
+need_root_and_prepare();
+
+try1();
+try2();
+
+sub try1 {
+ urpmi_addmedia("--distrib $::pwd");
+ check_urpmi('various', 'various2');
+
+ urpmi_update('--ignore Various');
+ check_conf('Various' => { ignore => 1 });
+ test_urpmi_fail('--auto various');
+
+ check_conf('Various Debug' => { ignore => 1 });
+ test_urpmi_fail('various-debug');
+
+ urpmi_update('--no-ignore "Various Debug"');
+ urpmi_update('"Various Debug"');
+ check_conf('Various Debug' => { ignore => undef });
+ check_urpmi('various-debug');
+
+ urpmi_removemedia('-a');
+}
+# same as above, except urpmi.update is done before urpmi.update --no-ignore
+sub try2 {
+ my ($want, $want3, $options) = @_;
+
+ urpmi_addmedia("--distrib $::pwd");
+
+ urpmi_update('"Various Debug"');
+ check_conf('Various Debug' => { ignore => 1 });
+ test_urpmi_fail('various-debug');
+
+ urpmi_update('--no-ignore "Various Debug"');
+ check_conf('Various Debug' => { ignore => undef });
+ check_urpmi('various-debug');
+
+ urpmi_removemedia('-a');
+}
+
+sub check_conf {
+ my (%want) = @_;
+ my $config = urpm::cfg::load_config("root/etc/urpmi/urpmi.cfg");
+ my %media = map { $_->{name} => $_ } @{$config->{media}};
+ foreach my $name (keys %want) {
+ foreach my $field (keys %{$want{$name}}) {
+ my $val = $want{$name}{$field};
+ is($media{$name}{$field}, $want{$name}{$field}, "$name:$field");
+ }
+ }
+}
+
+sub check_urpmi {
+ my (@names) = @_;
+ urpmi(join(' ', @names));
+ check_installed_and_remove(@names);
+}