File: rest_user_cf.t

package info (click to toggle)
request-tracker5 5.0.7%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 80,216 kB
  • sloc: javascript: 191,898; perl: 87,146; sh: 1,412; makefile: 487; python: 37; php: 15
file content (25 lines) | stat: -rw-r--r-- 672 bytes parent folder | download | duplicates (6)
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
use strict;
use warnings;
use RT::Interface::REST;

use RT::Test tests => undef;

my ( $baseurl, $m ) = RT::Test->started_ok;

my $cf = RT::Test->load_or_create_custom_field(
    Name       => 'foo',
    Type       => 'Freeform',
    LookupType => 'RT::User',
);
$cf->AddToObject(RT::User->new(RT->SystemUser));

my $root = RT::User->new( RT->SystemUser );
$root->Load('root');
$root->AddCustomFieldValue( Field => 'foo', Value => 'blabla' );
is( $root->FirstCustomFieldValue('foo'), 'blabla', 'cf is set' );

ok( $m->login, 'logged in' );
$m->post( "$baseurl/REST/1.0/show", [ id => 'user/14', ] );
like( $m->content, qr/CF-foo: blabla/, 'found the cf' );

done_testing;