File: 29-get_log.t

package info (click to toggle)
libmediawiki-bot-perl 5.007000-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 656 kB
  • sloc: perl: 1,992; makefile: 5
file content (50 lines) | stat: -rw-r--r-- 1,451 bytes parent folder | download | duplicates (2)
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
use strict;
use warnings;
use Test::RequiresInternet 'test.wikipedia.org' => 80;
use Test::More tests => 1;

use MediaWiki::Bot;

my $t = __FILE__;

my $bot = MediaWiki::Bot->new({
    agent   => "MediaWiki::Bot tests (https://metacpan.org/MediaWiki::Bot; $t)",
    host    => 'test.wikipedia.org',
});

my $is = $bot->get_log({
    type    => 'delete',
    user    => 'Mark',
    target  => 'Main Page',
    limit   => 1,
});
my $ought = [
          {
            'ns' => 0,
            'timestamp' => '2007-05-07T17:06:47Z',
            'comment' => '24 revisions restored',
            'pageid' => 11791,
            'action' => 'restore',
            'user' => 'Mark',
            'title' => 'Main Page',
            'type' => 'delete',
            'logid' => 3672,
            'logpage' => 0,
            'params' => {},
          },
          {
            'ns' => 0,
            'timestamp' => '2007-05-07T16:58:39Z',
            'comment' => 'content was: \'This is a test wiki that runs from the current NFS copy of MediaWiki. Changes to the code will generally appear here a few minutes before they appear ...\'',
            'pageid' => 11791,
            'action' => 'delete',
            'user' => 'Mark',
            'title' => 'Main Page',
            'type' => 'delete',
            'logid' => 3671,
            'logpage' => 0,
            'params' => {},
          }
        ];

is_deeply($is, $ought, 'The same - all the way down');