5 use RT::Test nodata => 1, tests => 24;
17 my $q = RT::Queue->new(RT->SystemUser);
18 is($q->IsValidStatus('new'), 1, 'New is a valid status');
19 is($q->IsValidStatus('f00'), 0, 'f00 is not a valid status');
26 my $q = RT::Queue->new(RT->SystemUser);
27 is($q->IsActiveStatus('new'), 1, 'New is a Active status');
28 is($q->IsActiveStatus('rejected'), 0, 'Rejected is an inactive status');
29 is($q->IsActiveStatus('f00'), 0, 'f00 is not a Active status');
36 my $q = RT::Queue->new(RT->SystemUser);
37 is($q->IsInactiveStatus('new'), 0, 'New is a Active status');
38 is($q->IsInactiveStatus('rejected'), 1, 'rejeected is an Inactive status');
39 is($q->IsInactiveStatus('f00'), 0, 'f00 is not a Active status');
46 my $queue = RT::Queue->new(RT->SystemUser);
47 my ($id, $val) = $queue->Create( Name => 'Test1');
50 ($id, $val) = $queue->Create( Name => '66');
58 my $Queue = RT::Queue->new(RT->SystemUser);
59 my ($id, $msg) = $Queue->Create(Name => "Foo");
60 ok ($id, "Foo $id was created");
61 ok(my $group = RT::Group->new(RT->SystemUser));
62 ok($group->LoadQueueRoleGroup(Queue => $id, Type=> 'Requestor'));
63 ok ($group->Id, "Found the requestors object for this Queue");
66 my ($status, $msg) = $Queue->AddWatcher(Type => 'Cc', Email => 'bob@fsck.com');
67 ok ($status, "Added bob at fsck.com as a requestor") or diag "error: $msg";
70 ok(my $bob = RT::User->new(RT->SystemUser), "Creating a bob rt::user");
71 $bob->LoadByEmail('bob@fsck.com');
72 ok($bob->Id, "Found the bob rt user");
73 ok ($Queue->IsWatcher(Type => 'Cc', PrincipalId => $bob->PrincipalId), "The Queue actually has bob at fsck.com as a requestor");
76 my ($status, $msg) = $Queue->DeleteWatcher(Type =>'Cc', Email => 'bob@fsck.com');
77 ok ($status, "Deleted bob from Ccs") or diag "error: $msg";
78 ok (!$Queue->IsWatcher(Type => 'Cc', PrincipalId => $bob->PrincipalId),
79 "The Queue no longer has bob at fsck.com as a requestor");
82 $group = RT::Group->new(RT->SystemUser);
83 ok($group->LoadQueueRoleGroup(Queue => $id, Type=> 'Cc'));
84 ok ($group->Id, "Found the cc object for this Queue");
85 $group = RT::Group->new(RT->SystemUser);
86 ok($group->LoadQueueRoleGroup(Queue => $id, Type=> 'AdminCc'));
87 ok ($group->Id, "Found the AdminCc object for this Queue");