summaryrefslogtreecommitdiff
path: root/xt/fake.t
blob: 1427b467df94de9bcf6c44d61b421d336d232134 (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
50
51
52
#!perl
use strict;
use warnings;

use File::Find::Rule;
use File::Spec;
use File::Temp qw(tempdir);
use CPAN::Mini;

use Test::More;

my $tempdir = tempdir(CLEANUP => 1);

CPAN::Mini->update_mirror(
  remote => "http://fakecpan.org/fake/minicpan/1.001/cpan",
  local  => $tempdir,
  log_level  => 'fatal',
);

pass("performed initial mirror");

CPAN::Mini->update_mirror(
  remote => "http://fakecpan.org/fake/minicpan/1.002/cpan",
  local  => $tempdir,
  log_level  => 'fatal',
);

pass("performed mirror update");

my @files = File::Find::Rule->file->in($tempdir);
$_ = File::Spec->abs2rel($_, $tempdir) for @files;

my @want = qw(
  RECENT
  authors/01mailrc.txt.gz
  authors/id/O/OP/OPRIME/Bug-Gold-9.001.tar.gz
  authors/id/O/OP/OPRIME/CHECKSUMS
  authors/id/O/OP/OPRIME/XForm-Rollout-1.00.tar.gz
  authors/id/X/XY/XYZZY/CHECKSUMS
  authors/id/X/XY/XYZZY/Hall-MtKing-0.01.tar.gz
  authors/id/X/XY/XYZZY/Y-2.tar.gz
  modules/02packages.details.txt.gz
  modules/03modlist.data.gz
);

is_deeply(
  [ sort @files ],
  [ sort @want  ],
  "we end up with just the files we expect",
);

done_testing;