summaryrefslogtreecommitdiff
path: root/FS-Test/bin/freeside-test-fetch
blob: 953005704d99f199ec05b448d16c2c02580d8425 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl

use strict;
use Getopt::Std;
use File::Spec;

my @dirs = File::Spec->splitdir(File::Spec->rel2abs(__FILE__));
splice @dirs, -2; # bin/freeside-test-run
push @INC, File::Spec->catdir( @dirs, 'lib' );
eval "use FS::Test;";
die $@ if $@;

my %opt;

my $username = 'test';
my $password = 'test';

getopts('d:U:', \%opt);
die usage() unless $opt{d};
my $test = FS::Test->new( dir => $opt{d} );
$test->fsurl($opt{U}) if $opt{U};

my $testfile = $test->share_dir . '/ui_tests';
open my $fh, '<', $testfile
  or die "Couldn't read tests from '$testfile': $!\n";
$test->fetch( <$fh> );

sub usage {
  "Usage: $0 -d directory [ -U base_URI ]\n\n";
}

=head1 NAME

freeside-test-fetch - download a list of UI pages for testing

=head1 USAGE

freeside-test-fetch -d /tmp/outputdir [ -U http://myserver/freeside ]

=head1 ARGUMENTS

-d: the directory to put the files in. Required.

-U: the URL prefix for the Freeside server. Defaults to
"http://localhost/freeside".

The list of tests is in the 'ui_tests' file included with FS::Test.

=cut