2 use Test::More tests => 24;
10 my $attribute = "squelch-$runid";
12 ok(require RT::Attributes);
14 my $user = RT::User->new($RT::SystemUser);
15 ok (UNIVERSAL::isa($user, 'RT::User'));
16 my ($id,$msg) = $user->Create(Name => 'attrtest-'.$runid);
18 ok($user->id, "Created a test user");
20 ok(1, $user->Attributes->BuildSelectQuery);
21 my $attr = $user->Attributes;
23 ok(1, $attr->BuildSelectQuery);
26 ok (UNIVERSAL::isa($attr,'RT::Attributes'), 'got the attributes object');
28 ($id, $msg) = $user->AddAttribute(Name => 'TestAttr', Content => 'The attribute has content');
30 is ($attr->Count,1, " One attr after adidng a first one");
31 ($id, $msg) = $attr->DeleteEntry(Name => $runid);
32 ok(!$id, "Deleted non-existant entry - $msg");
33 is ($attr->Count,1, "1 attr after deleting an empty attr");
35 my @names = $attr->Names;
36 is ("@names", "TestAttr");
39 ($id, $msg) = $user->AddAttribute(Name => $runid, Content => "First");
41 is ($attr->Count,2, " Two attrs after adding an attribute named $runid");
42 ($id, $msg) = $user->AddAttribute(Name => $runid, Content => "Second");
45 is ($attr->Count,3, " Three attrs after adding a secondvalue to $runid");
46 ($id, $msg) = $attr->DeleteEntry(Name => $runid, Content => "First");
51 ($id, $msg) = $attr->DeleteEntry(Name => $runid, Content => "Second");
56 ok(1, $attr->BuildSelectQuery);
57 ($id, $msg) = $attr->DeleteEntry(Name => "moose");
58 ok(!$id, "Deleted non-existant entry - $msg");
61 ok(1, $attr->BuildSelectQuery);
62 @names = $attr->Names;
63 is("@names", "TestAttr");