From dfc692d5cfbb26fdc6494d862c6c14691b7fe986 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Wed, 30 Jun 2004 06:54:29 +0000 Subject: Functions to write proxy.cfg (and regression tests) --- t/cfg.t | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/cfg.t b/t/cfg.t index 45403e24..77c831ff 100644 --- a/t/cfg.t +++ b/t/cfg.t @@ -1,11 +1,13 @@ #!/usr/bin/perl -use Test::More tests => 4; +use Test::More 'no_plan'; use MDK::Common; BEGIN { use_ok 'urpm::cfg' } +BEGIN { use_ok 'urpm::download' } my $file = 'testurpmi.cfg'; +my $proxyfile = $urpm::download::PROXY_CFG = 'testproxy.cfg'; open my $f, '>', $file or die $!; print $f (my $cfgtext = <', $proxyfile or die $!; +print $f ($cfgtext = <{http_proxy}, 'http://foo:8080/', 'read proxy' ); +ok( !defined $p->{user}, 'no user defined' ); +$p = get_proxy('local'); +is( $p->{http_proxy}, 'http://yoyodyne:8080/', 'read media proxy' ); +is( $p->{user}, 'rafael', 'proxy user' ); +is( $p->{pwd}, 'richard', 'proxy password' ); +ok( dump_proxy_config(), 'dump_proxy_config' ); +$cfgtext2 = cat_($proxyfile); +$cfgtext2 =~ s/# generated.*\n//; +is( $cfgtext, $cfgtext2, 'dumped correctly' ); +set_proxy_config(http_proxy => ''); +ok( dump_proxy_config(), 'dump_proxy_config erased' ); +$cfgtext2 = cat_($proxyfile); +$cfgtext2 =~ s/# generated.*\n//; +$cfgtext =~ s/^http_proxy.*\n//; +is( $cfgtext, $cfgtext2, 'dumped correctly' ); + +END { unlink $file, $file.2, $proxyfile } -- cgit v1.2.1