5 use RT::Test nodata => 1, tests => 16;
11 # Skipping most of the methods added just to make RT::System
12 # look like RT::Record.
14 can_ok('RT::System', qw( AvailableRights RightCategories AddRight
15 id Id SubjectTag Name QueueCacheNeedsUpdate AddUpgradeHistory
20 my $s = RT::System->new(RT->SystemUser);
21 my $rights = $s->AvailableRights;
22 ok ($rights, "Rights defined");
23 ok ($rights->{'AdminUsers'},"AdminUsers right found");
24 ok ($rights->{'CreateTicket'},"CreateTicket right found");
25 ok ($rights->{'AdminGroupMembership'},"ModifyGroupMembers right found");
26 ok (!$rights->{'CasdasdsreateTicket'},"bogus right not found");
32 my $sys = RT::System->new();
33 is( $sys->Id, 1, 'Id is 1');
34 is ($sys->id, 1, 'id is 1');
40 # Test upgrade history methods.
42 my $sys = RT::System->new(RT->SystemUser);
43 isa_ok($sys, 'RT::System');
45 my $file = 'test_file.txt';
46 my $content = 'Some file contents.';
47 my $upgrade_history = RT->System->UpgradeHistory();
49 is( keys %$upgrade_history, 0, 'No history in test DB');
51 RT->System->AddUpgradeHistory(RT =>{
58 $upgrade_history = RT->System->UpgradeHistory();
59 ok( exists($upgrade_history->{'RT'}), 'History has an RT key.');
60 is( @{$upgrade_history->{'RT'}}, 1, '1 item in history array');
61 is($upgrade_history->{RT}[0]{stage}, 'before', 'stage is before for item 1');
63 RT->System->AddUpgradeHistory(RT =>{
70 $upgrade_history = RT->System->UpgradeHistory();
71 is( @{$upgrade_history->{'RT'}}, 2, '2 item in history array');
72 is($upgrade_history->{RT}[1]{stage}, 'after', 'stage is after for item 2');